Posted By:
James_Bayer
Posted On:
Wednesday, February 26, 2003 07:33 AM
i use the property configurator:
PropertyConfigurator.configure( "fullpath to property file here" );
this setup uses 2 files and the console and i have no problems with it:
# For the general syntax of property based configuration files see the
# documenation of org.apache.log4j.PropertyConfigurator.
# The root category uses the appender called A1 with specified priority of INFO.
log4j.rootCategory=INFO, A1, E, A2
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
# Print the date in ISO 8601 format
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
############################################################
# E is the RollingFileAppender that outputs to an error log
# file called error.log.
############################################################
log4j.appender.E=org.apache.log4j.FileAppender
log4j.appender.E.File=error.log
# Define a pattern layout for the file.
# For more information on conversion characters (i.e. d,p,t,c,l,m,n)
# please see the PatternLayout class of the Log4j API.
log4j.appender.E.layout=org.apache.log4j.PatternLayout
# The following normally appears on one single line.
log4j.appender.E.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
# Set the max size of the file
log4j.appender.E.threshold=ERROR
############################################################
# A2 is the FileAppender that outputs to an log
# file called output.log
############################################################
log4j.appender.A2=org.apache.log4j.FileAppender
log4j.appender.A2.File=output.log
# Define a pattern layout for the file.
# For more information on conversion characters (i.e. d,p,t,c,l,m,n)
# please see the PatternLayout class of the Log4j API.
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
# The following normally appears on one single line.
log4j.appender.A2.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
# Set the max size of the file
log4j.appender.A2.threshold=INFO