https://issues.apache.org/bugzilla/show_bug.cgi?id=53781

--- Comment #4 from Raj <[email protected]> ---
This is a pretty unique scenario.

I use a RollingFileAppender to route the log messages to a file. Following is
the code in the BeforeMethod. The appender "FILE" is configured in the
log4j.xml

    @BeforeMethod (alwaysRun = true)
    public void beforeCreateSeparateLogFile(Method method) 
    {

        String fileName = method.getName(); 
        String fileSep = System.getProperty("file.separator");
        RollingFileAppender rfa = (RollingFileAppender)
Logger.getRootLogger().getAppender("FILE");
        rfa.setFile("TestOutput" + fileSep + fileName + ".log");
        rfa.activateOptions();

        log.info("STARTING TESTCASE : " + method.getName());
        log.info("");

    }


By doing this, I can get the log messages per test case in its own log file. I
do this because of specific test framework related reasons and easier
troubleshooting when a test case fails.

Now, imagine the above code getting executed in a multithreaded way. Since
there is only one logger instance, some other thread can change the route of
the messages. That way the messages get mixed up and end up in a wrong file.
The reason why I suggested having multiple instances is because every instance
can be in its own thread without affecting each  other.


I hope that helps understanding the problem that I am facing.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to