你用这个试试
# Set the root logger level to DEBUG and its only appender to rollinglog4j.rootLogger=DEBUG, rolling, stdout# Set the logger level for everything under "org.apache" to WARN
log4j.logger.org.apache=WARN# Set the logger level for "org.apache.commons.validator.ValidatorUtil" to
# FATAL because we know that errors will be generated here that we want to
# ignore (due to the fact that it is unknown whether a consumer is personal
# or business and the validation.xml file is not set up to accomodate the
# differences)log4j.logger.org.apache.commons.validator.ValidatorUtil=FATAL
log4j.logger.org.apache.log4j.TextLogger=INFO
# Configure the stdout appender to be a ConsoleAppender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender# Configure the stdout appender to use the PatternLayout
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout# Configure the conversion pattern for the stdout appender
log4j.appender.stdout.layout.ConversionPattern=%d - %p %c - %m%n# Configure the rolling appender to be a RollingFileAppender
log4j.appender.rolling=org.apache.log4j.RollingFileAppender# Configure the name of the log file for the rolling appender
log4j.appender.rolling.File=test.log   #
 
# Configure the maximum size of the log file for the rolling appender
#log4j.appender.rolling.MaxFileSize=4MB# Keep one backup file of the rolling appender
#log4j.appender.rolling.MaxBackupIndex=5# Configure the rolling appender to use the PatternLayout
log4j.appender.rolling.layout=org.apache.log4j.PatternLayout# Configure the conversion pattern for the rolling appender
log4j.appender.rolling.layout.ConversionPattern=%d - %p %c - %m%n