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" name="RootFileAppender"
              encoding="UTF-8">
        <file>trace/WTPMS.log</file>

Into this:

 <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="RootFileAppender"
              encoding="UTF-8">
        <file>trace/${Server}.log</file>

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
ALCATEL-LUCENT
Marco.Bresciani@alcatel-lucent.com