log4j.properties input log to file.

# Set the enterprise logger category to FATAL and its only appender to CONSOLE.
log4j.rootLogger=info,CONSOLE,FILE

# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n

# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=axis.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.Threshold=INFO
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

#input log to file.
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=d:/log4j.log
log4j.appender.FILE.MaxFileSize=10mb
log4j.appender.FILE.MaxBackupIndex=3
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d %5p  (%F:%L) - %m%n

你可能感兴趣的:(apache,C++,c,log4j,C#)