-
1. Re: MDC specfic logger?
jamezp May 10, 2016 7:27 PM (in response to nickarls)There's currently not a way to do this. You might be able to write a custom-handler to do it though.
Do you want to be able to filter messages on a logger to log to different handlers?
--
James R. Perkins
-
2. Re: MDC specfic logger?
nickarls May 11, 2016 1:58 AM (in response to jamezp)I can think of multiple scenarios where grouping would be handy
- Collecting a single user session into a file
- Collect a single host activity to a file
- Collect the lifecycle of an entity (e.g. a long-lived order or process) into a single file
Something in the line of a normal file appender but it would have some sort of LogFilePolicyClass that would be responsible for returning the correct log file to write to (creating it if it doesn't exist). There might be some lookup table or cache in order to avoid performance problems due to constant file-switching(?). Of course most of this stuff is doable with various log analyzers or general grepping but it could still be useful.
-
3. Re: MDC specfic logger?
nickarls May 11, 2016 4:32 AM (in response to jamezp)I created a feature request for this: [WFLY-6601] Application context specific log handler - JBoss Issue Tracker
-
4. Re: MDC specfic logger?
jamezp May 11, 2016 2:40 PM (in response to nickarls)1 of 1 people found this helpfulOkay makes sense. It's something to consider for sure. The context switching could be a bit expensive, but it could also be wrapped in a async-handler.
For a log collector you could use something like the ELK stack which I think will allow filtering based on MDC entries. If you haven't seen it here's a small post on how to configure WildFly for the ELK stack Centralized Logging for WildFly with the ELK Stack · WildFly.
--
James R. Perkins
-
5. Re: MDC specfic logger?
nickarls May 16, 2016 3:09 AM (in response to jamezp)My company is about to start a project where we get paid for contributing to Open Source projects so I might have a stab at this.
I noticed that the WriterHandler has a preWrite method. If the logger class holds a MDC-value -> log file mapping, this could be used for file selection, right?
-
6. Re: MDC specfic logger?
khantariquealam May 16, 2016 9:18 AM (in response to nickarls)Hello Nicklas,
We are able to achieve similar requirement in Wildfly 8.2.1 (related to value put in MDC).
Hope this link can help to fulfill your requirement https://developer.jboss.org/message/946929#946929
-Tarique
-
7. Re: MDC specfic logger?
jamezp May 16, 2016 11:52 AM (in response to nickarls)Yeah that would work and thanks! Just ping me if you have any questions along the way.
--
James R. Perkins