#### Use two appenders, one to log to console, another to log to a file log4j.rootCategory=debug,stdout, R # Print only messages of priority WARN or higher for your category log4j.category.your.category.name=WARN #### First appender writes to console log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout # Pattern to output the caller's file name and line number. log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n ######################## # JDBC Appender #### Second appender writes to a file log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=daily.log # Control the maximum log file size log4j.appender.R.MaxFileSize=2048KB # Archive log files (one backup file here) log4j.appender.R.MaxBackupIndex=50 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%-5r %-5p [%t] %c{2} %l %d - %m%n日志 是程序里 log.info .err 写入的 ,在程序控制
log4j.rootCategory=debug,stdout, R
# Print only messages of priority WARN or higher for your category
log4j.category.your.category.name=WARN
#### First appender writes to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
########################
# JDBC Appender
#### Second appender writes to a file
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=daily.log
# Control the maximum log file size
log4j.appender.R.MaxFileSize=2048KB
# Archive log files (one backup file here)
log4j.appender.R.MaxBackupIndex=50
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%-5r %-5p [%t] %c{2} %l %d - %m%n日志 是程序里 log.info .err 写入的 ,在程序控制
[email protected]
20060423
看这
建立一个目录 如 abc
log4j.appender.R.File=abc/daily.log