2 sunnyyoona SunnyYoona 于 2016.01.16 20:58 提问

Log4j问题

Error:

log4j:ERROR Could not find value for key log4j.appender.FILE.layout
log4j:ERROR No layout set for the appender named [FILE].

配置:

 # Define the root logger with appender file
log = D://WorkSpace/logs/
log4j.rootLogger = debug, FILE
# Define the file appender
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.File=${log}log.out
Log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
Log4j.appender.FILE.layout.ConversionPattern=%t-%x-%-5p-%-10c:%m%n

2个回答

caozhy
caozhy   Ds   Rxr 2016.01.16 21:18
Evankaka
Evankaka   Ds   Rxr 2016.01.16 22:46

下面是我的,没问题。你直接用试试看

 log4j.rootLogger=DEBUG,Console,Stdout  

#Console  
log4j.appender.Console=org.apache.log4j.ConsoleAppender  
log4j.appender.Console.layout=org.apache.log4j.PatternLayout  
log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n  

log4j.logger.java.sql.ResultSet=INFO  
log4j.logger.org.apache=INFO  
log4j.logger.java.sql.Connection=DEBUG  
log4j.logger.java.sql.Statement=DEBUG  
log4j.logger.java.sql.PreparedStatement=DEBUG   

log4j.appender.Stdout = org.apache.log4j.DailyRollingFileAppender    
log4j.appender.Stdout.File = E://logs/log.log    
log4j.appender.Stdout.Append = true    
log4j.appender.Stdout.Threshold = DEBUG     
log4j.appender.Stdout.layout = org.apache.log4j.PatternLayout    
log4j.appender.Stdout.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss}  [ %t:%r ] - [ %p ]  %m%n   
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!