Include host and port in mdc if clustered or remote #28073
This commit is contained in:
parent
38c938124e
commit
4588a3904f
13 changed files with 199 additions and 40 deletions
|
|
@ -401,7 +401,7 @@ With Logback the actor path is available with `%X{akkaSource}` specifier within
|
|||
</encoder>
|
||||
```
|
||||
|
||||
The actor system in which the logging was performed is available in the MDC with attribute name `sourceActorSystem`,
|
||||
The actor system name in which the logging was performed is available in the MDC with attribute name `sourceActorSystem`,
|
||||
but that is typically also included in the `akkaSource` attribute.
|
||||
With Logback the ActorSystem name is available with `%X{sourceActorSystem}` specifier within the pattern layout configuration:
|
||||
|
||||
|
|
@ -411,9 +411,20 @@ With Logback the ActorSystem name is available with `%X{sourceActorSystem}` spec
|
|||
</encoder>
|
||||
```
|
||||
|
||||
Akka's internal logging is asynchronous which means that the timestamp of a log entry is taken from
|
||||
The address of the actor system, containing host and port if the system is using cluster, is available through `akkaAddress`:
|
||||
|
||||
```
|
||||
<encoder>
|
||||
<pattern>%date{ISO8601} %-5level %logger{36} %X{akkaAddress} - %msg%n</pattern>
|
||||
</encoder>
|
||||
```
|
||||
|
||||
|
||||
For typed actors the log event timestamp is taken when the log call was made but for
|
||||
Akka's _internal_ logging as well as the classic actor logging is asynchronous which means that the timestamp of a log entry is taken from
|
||||
when the underlying logger implementation is called, which can be surprising at first.
|
||||
If you want to more accurately output the timestamp, use the MDC attribute `akkaTimestamp`.
|
||||
If you want to more accurately output the timestamp for such loggers, use the MDC attribute `akkaTimestamp`. Note that
|
||||
the MDC key will not have any value for a typed actor.
|
||||
With Logback the timestamp is available with `%X{akkaTimestamp}` specifier within the pattern layout configuration:
|
||||
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue