A better way to handle this case is to have a custom appender that routes the message to the appropriate file (which be delegating to a RFA if you so desire). Search the dev archives for the MultiFileAppender to read previous discussion on the topic and links to the sandbox implementation. That effort has been stalled for quite some time, but addressing a file per thread was a key use case.

Sharing layouts between appenders may be problematic.

The approach that you've taken requires that you are very careful that you do not share logger instance variables between threads and I think that is the most likely source of your problem. If you have one class like:

public class Foo {
   private static final logger = YourLogFactory.getLogger("Foo");

   public Foo() {
   }

   public void execute() {
        logger.info("Hello, World");
   }
}

Then the messages logged in execute will appear to be associated with the thread that caused the Foo class to be initialized, not the thread calling Foo.execute.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to