Hi all,

I've got a project where I want separate classes to log to separate files.
To do this my config file is looking like this:
===== start log4j.properties =====
#
# Log 4j Settings
#
# anything that's not classified goes to the default logfile, anything
# that we haven't written goes to the screen.
#
log4j.rootCategory=INFO,stdout
log4j.category.com.csc.ipd=INFO,default
log4j.additivity.com.csc.ipd=false

#
# io specific class and levels
#
log4j.category.com.csc.ipd.icr.io=INFO, io
log4j.category.com.csc.ipd.icr.distributor=INFO, io
log4j.category.com.csc.ipd.icr.protocols=INFO, io
log4j.category.com.csc.ipd.icr.tools=INFO, io
log4j.category.com.csc.ipd.idl=INFO, io
log4j.additivity.com.csc.ipd.icr.io=false
log4j.additivity.com.csc.ipd.icr.distributor=false
log4j.additivity.com.csc.ipd.icr.protocols=false
log4j.additivity.com.csc.ipd.icr.tools=false
log4j.additivity.com.csc.ipd.icr.idl=false

#
#icr manager class and levels
#
log4j.category.com.csc.ipd.icr.customer=INFO,icrmanager
log4j.category.com.csc.ipd.icr.fileinterface=INFO,icrmanager
log4j.additivity.com.csc.ipd.icr.customer=false
log4j.additivity.com.csc.ipd.icr.fileinterface=false


###
# specification of different logs
###

# stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%-5p %c{2} %x - %m%n
log4j.appender.stdout.Threshold=ERROR

# default
log4j.appender.default=org.apache.log4j.RollingFileAppender
log4j.appender.default.File=../log/CSC-ICR.log
log4j.appender.default.MaxFileSize=100kb
log4j.appender.default.MaxBackupIndex=10
log4j.appender.default.layout=org.apache.log4j.PatternLayout
log4j.appender.default.layout.ConversionPattern=%d %-5p %c{2} %x - %m%n

# io
log4j.appender.io=org.apache.log4j.RollingFileAppender
log4j.appender.io.File=../log/ICRIO.log
log4j.appender.io.MaxFileSize=100kb
log4j.appender.io.MaxBackupIndex=10
log4j.appender.io.layout=org.apache.log4j.PatternLayout
log4j.appender.io.layout.ConversionPattern=%d %-5p %c{2} %x - %m%n

# icrmanager
log4j.appender.icrmanager=org.apache.log4j.RollingFileAppender
log4j.appender.icrmanager.File=../log/ICRManager.log
log4j.appender.icrmanager.MaxFileSize=100kb
log4j.appender.icrmanager.MaxBackupIndex=10
log4j.appender.icrmanager.layout=org.apache.log4j.PatternLayout
log4j.appender.icrmanager.layout.ConversionPattern=%d %-5p %c{2} %x - %m%n

===== end log4j.properties =====

Which doesn't look too good to me, but it works. I'd rater have the io and
icrmanager appenders inherit stuff from de default log, thus getting the
following log file:

===== start log4j.properties =====
#
# Log 4j Settings
#
# anything that's not classified goes to the default logfile, anything
# that we haven't written goes to the screen.
#
log4j.rootCategory=INFO,stdout
log4j.category.com.csc.ipd=INFO,default
log4j.additivity.com.csc.ipd=false

#
# io specific class and levels
#
log4j.category.com.csc.ipd.icr.io=INFO, io
log4j.category.com.csc.ipd.icr.distributor=INFO, io
log4j.category.com.csc.ipd.icr.protocols=INFO, io
log4j.category.com.csc.ipd.icr.tools=INFO, io
log4j.category.com.csc.ipd.idl=INFO, io

#####
##### this should somehow be inhereted by io and icrmanager, I guess
#####
log4j.additivity.com.csc.ipd=false

#
#icr manager class and levels
#
log4j.category.com.csc.ipd.icr.customer=INFO,icrmanager
log4j.category.com.csc.ipd.icr.fileinterface=INFO,icrmanager

###
# specification of different logs
###

# stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%-5p %c{2} %x - %m%n
log4j.appender.stdout.Threshold=ERROR

#####
##### this should somehow be inhereted by io and icrmanager, I guess
#####
# default
log4j.appender.default=org.apache.log4j.RollingFileAppender
log4j.appender.default.File=../log/CSC-ICR.log
log4j.appender.default.MaxFileSize=100kb
log4j.appender.default.MaxBackupIndex=10
log4j.appender.default.layout=org.apache.log4j.PatternLayout
log4j.appender.default.layout.ConversionPattern=%d %-5p %c{2} %x - %m%n

# io
log4j.appender.io.File=../log/ICRIO.log

# icrmanager
log4j.appender.icrmanager.File=../log/ICRManager.log

===== end log4j.properties =====

Can this be done?

groeten,

Friso
--
Bakenmonde 2
3434 KK Nieuwegein
030 - 6007 249


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

Reply via email to