Search the archives. One file per thread has been discussed and I think someone made an appender that does it.
On 5/14/07, rovelgoenne <[EMAIL PROTECTED]> wrote:
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]
-- James Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]