I start multiple threads where every thread should log to his own file.
Therefor I did:
- every thread has a number
- for every thread I get a logger with "name" + number
- in every logger I add an DailyRollingFileAppender
- in the thread I log to the connected logger
So everything works fine. Every thread logs to his file.

Code (initialization):
DailyRollingFileAppender fileAppender;
            for ( int i = 0; i < multiplicity; i++ )
            {
                fileAppender = new DailyRollingFileAppender( layout, 
"c:/log/temp" + i + ".log" "'.'yyyy-MM-dd" );              
                Logger logger = Logger.getLogger( "logger" + i );
                logger.addAppender( fileAppender );
            }

There is only a problem in heavy logging in all threads. In this situation
sometimes logging entries (or parts of it) from one thread show up in the
logging file of another thread. 
Has someone an idea about the reason of such an behavour? Is my solution not
suitable for such a problem?
Do I have to use a different appender (because of the amount of logging
entries I have to use something like DailyRollingFileAppender)? 
I searched the hole mailing list for an answer but I didn't found something
about these exact problem.
-- 
View this message in context: 
http://www.nabble.com/DailyRollingFileAppender-for-multiple-threads-tf3752882.html#a10605350
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to