I have a project and I work with threads in this project. I have the log4j file and thanks to this file I can write the logs to a log file but what I want is not to write to a log file.I want separate log files to be kept for each thread and they are not compatible with each other. Is it possible ?
I using this log4j.properties
#log4j.rootLogger = INFO, FILE
log4j.rootLogger = DEBUG, DAILY
# Define the FILE appender
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.R.File=Logfile.log
# Define the layout for FILE appender
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.conversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %t %-5p %c %M %x - %m%n
# Define the DAILY appender
log4j.appender.DAILY=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DAILY.File=Logfile.log
log4j.appender.DAILY.DatePattern='.'yyyyMMdd
# Define the layout for DAILY appender
log4j.appender.DAILY.layout=org.apache.log4j.PatternLayout
log4j.appender.DAILY.layout.conversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %t %-5p %c %M %x - %m%n
But I must change this now. For example, I have 2 classes extended from the thread running on the main class. these classes are called foo and bar. I want it to be written to the log file number 1 while the foo class is running, and to the log file number 2 while the bar class is running. What should I do ?