[logback-user] Logging separation with JavaSE

BRESCIANI, MARCO (MARCO) marco.bresciani at alcatel-lucent.com
Fri Jan 13 11:37:06 CET 2012

Hello all,
  I've read the logging separation chapter of the manual since my customers 
(and our tech support) are requiring to separate log file for each 
"application". Brief description of the application: something like, say, 
Word: a container application (with a MDC called %X{Server} with a string, 
say, "Main") plus some different "internal" applications loaded at runtime 
(with a MDC called %X{Address} being an IP address).
  When the application starts there is the %X{Server} MDC while when on of the 
internal applications is loaded by the main one, such application sets the MDC 
with its own IP. Seems working fine. :)

I've been asked to split the log files according to the MDC (because it's "too 
difficult to use a regexp to filter the file". You know, customers...) and 
reading the logging separation chapter, I modified my appender:

 <appender class="ch.qos.logback.core.rolling.RollingFileAppender" 

Into this:

 <appender class="ch.qos.logback.core.rolling.RollingFileAppender" 

And logback creates a file called "Server_IS_UNDEFINED.log", probably because 
the MDC is set after few (4-5) lines of checks that include a logging entry. 
Also, setting the MDC, anyway does not create a new file with the new name, 
even if the "scan" property is true.

Any possible solution to this kind of separation?

Thanks all,

Marco.Bresciani at alcatel-lucent.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120113/f7ffe48f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6553 bytes
Desc: not available
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120113/f7ffe48f/attachment.bin>

More information about the Logback-user mailing list