Skip to content

Commit 9ffdad6

Browse files
author
Sergey Firsov
committed
How to configure Json logging.
1 parent d111d19 commit 9ffdad6

1 file changed

Lines changed: 109 additions & 0 deletions

File tree

content/en/docs/refguide/runtime/monitoring-mendix-runtime.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,3 +533,112 @@ This request can only be executed when the Mendix Runtime status is "running" (s
533533
### Return Values
534534

535535
Returns feedback about the Mendix Runtime.
536+
537+
## Logging
538+
539+
Log subscriber is what renders logs. By changing log subscribers it is possible to configure the logs format.
540+
For that you need to make three steps:
541+
1. Get the name of your current log subscriber
542+
2. Delete your current log subscriber
543+
3. Create new log subscriber
544+
545+
### Request to get the name of your current log subscriber
546+
547+
```json
548+
{"action": "get_log_settings", "params": {"sort": "subscriber"}}
549+
```
550+
551+
### Example Response
552+
553+
```json
554+
{
555+
"feedback": {
556+
"ConsoleLogSubscriber": {
557+
"ConnectionBus_Queries": "INFO",
558+
"Configuration": "INFO",
559+
"Core": "INFO",
560+
"Logging": "INFO",
561+
"SchemeManager": "INFO",
562+
...
563+
}
564+
},
565+
"result": 0
566+
}
567+
```
568+
569+
If the `feedback` is not empty use the name of your current log subscriber in the next request. In this example the name is `"ConsoleLogSubscriber"`.
570+
571+
### Request to delete your current log subscriber
572+
573+
```json
574+
{"action": "remove_log_subscriber", "params": {"name": "ConsoleLogSubscriber"}}
575+
```
576+
577+
### Example Response
578+
579+
```json
580+
{
581+
"feedback": {},
582+
"result": 0
583+
}
584+
```
585+
586+
It is possible to have multiple log subscribers running simultaneously, if several log subscribers were created then each of them will be writing the same log lines.
587+
588+
### Request to create new log subscriber in Json format
589+
590+
```json
591+
{
592+
"action": "create_log_subscriber",
593+
"params": {
594+
"type": "console_json",
595+
"name": "JsonLogSubscriber",
596+
"autosubscribe": "INFO",
597+
"tags": {
598+
"ddtags": "env:test",
599+
"service": "my-application-name"
600+
}
601+
}
602+
}
603+
```
604+
605+
### Example Response
606+
607+
```json
608+
{
609+
"feedback": {},
610+
"result": 0
611+
}
612+
```
613+
614+
This will write logs to standard output in Json format. If you need to add extra static fields to tag logs then you can add them into `tags`, in this example `ddtags` and `service` are added.
615+
This configuration will produce logs similar to these:
616+
617+
```json
618+
{"node":"TaskQueue","level":"INFO","ddtags":"env:test","service":"my-application-name","message":"Rescheduling running tasks for expired XAS instance '169a16c5-a748-4e21-8efa-3a6057a14d8a'.","timestamp":1734629114040}
619+
{"node":"Core","level":"INFO","ddtags":"env:test","service":"my-application-name","message":"Mendix Runtime is now shut down.","timestamp":1734629114260}
620+
```
621+
622+
### Request to create new log subscriber in simple text format
623+
624+
```json
625+
{
626+
"action": "create_log_subscriber",
627+
"params": {
628+
"type": "console",
629+
"name": "SimpleTextLogSubscriber",
630+
"autosubscribe": "INFO"
631+
}
632+
}
633+
```
634+
635+
### Example Response
636+
637+
```json
638+
{
639+
"feedback": {},
640+
"result": 0
641+
}
642+
```
643+
644+
This will write logs to standard output in simple text format.

0 commit comments

Comments
 (0)