Conversation
|
Can one of the admins verify this patch? |
There was a problem hiding this comment.
The NULL !== seems unnecessary...
|
ok to test. Happy to finally see this PR, though still I'm not 100% convinced:
|
|
@kiesel : you're right, according to YAGNI, the env variables should not be registered into the context. I see 2 options here:
What do you guys say? |
|
I assume (and believe to remember from a discussion with @cconstandachi), that this is introduced because you'd need a place where all these variables are available to be collected. They're not available in any one arbitrary location in the code. So, maybe we can trigger being handed these information at the places where it happens now, but only on demand. I propose to:
I would refrain from providing an EnvironmentLogContext implementation, as that would prevent you from being either a NDC- or MDC-backed implementation... |
|
I refactored this PR as follow:
Let me know what you guys think. |
|
I can remove the environment variables injection (and the interface) and add it as a new pull request later if the case. I think it can be now regarded as a separate issue. |
|
I'm OK with this, for both 5.8 and 5.9 series. @kiesel - what do you say? |
|
No objections, I'd love to see this in 5.8 and 5.9. 👍 |
Hi,
This pull request adds context information to the logging mechanism. The following pull requests are related to this one: #124, #146 and #174.
Two log context implementations are provided:
NestedLogContext(same as log4j NDC)MappedLogContext(same as log4j MDC)More custom implementations can be added as needed; either in the framework or in an XP-Framework project.
To add context information to the logging mechanism,
log.inican be modified as follow:This pull request also adds environment information to LogContext (only if the LogCategory has a LogContext attached):
hostnamerunnerinstancereqourceparams.This info is automatically injected by the runners. It is not used anywhere in the logging output, but some custom
LogContextimplementation might make use of this information in it'sformat()method. We intend to use it in a custom Appender for the ErrorTool NG log server. If you think this adds too much overhead, I can remove it.