Log4j基于类的日志记录

时间:2011-03-18 07:35:24

标签: java logging log4j

我想根据课程进行日志记录。我创造了这样的东西:

log4j.appender.cancellation=org.apache.log4j.RollingFileAppender
log4j.appender.cancellation.MaxFileSize=10MB
log4j.appender.cancellation.Threshold=INFO
log4j.appender.cancellation.File=/logs/cancellation.log
log4j.appender.cancellation.layout=org.apache.log4j.PatternLayout
log4j.appender.cancellation.layout.ConversionPattern=%d %5p [%t] (%F:%L) - %m%n

log4j.logger.com.mydomain.bean.CancellationBean=cancellation

和我的班级:

private Logger logger = Logger.getLogger("com.mydomain.bean.CancellationBean");

但它没有用,有什么建议吗?

1 个答案:

答案 0 :(得分:0)

只是一个建议:

log4j.logger.com.mydomain.bean.CancellationBean=DEBUG, cancellation