log4j.appender.F.DatePattern = '_'yyyy-MM-dd'.log'
log4j.appender.F.File = D:/Eclipse/Project/liheng/logs/log
log4j.appender.F.Append = false
log4j.appender.F.Threshold = FATAL
log4j.appender.F.layout = org.apache.log4j.PatternLayout
log4j.appender.F.layout.ConversionPattern= [%-5p] %d - %c -%-4r [%t] %c %x - %m%n
这样的配置,想每天一个日志,但试过到另一天不能把原文件改名,
log4j:ERROR Failed to rename [D:/Eclipse/Project/liheng/logs/log] to [D:/Eclipse/Project/liheng/logs/log_2006-11-28.log]
出了这样的错,请问各位大哥有没有遇到这样的问题,找遍GOOGLE有人说这样解决:
We need to deinitialize/initialize logging mechanism every time we restart the server to terminate processes accessing log files.
To achieve this, I wrote one small listener implementing javax.servlet.ServletContextListener interface.
Everytime when context was destroyed, I shutdown log4j’s logging mechanism using org.apache.log4j.LogManager.shutdown() method.
Shutting down the mechanism made sure that all the processes that are using log files are terminated and this way resolved the issue.
不过我自己不会实现,如果上述方法可以,请问能给点提示小弟吗,万分致谢
3 个解决方案
#1
能帮帮忙吗各位大哥
#2
求求帮帮忙吧
#3
自己动手解决了,需要的请看我BLOG
http://blog.sina.com.cn/u/54c1567b010006bj
http://blog.sina.com.cn/u/54c1567b010006bj
#1
能帮帮忙吗各位大哥
#2
求求帮帮忙吧
#3
自己动手解决了,需要的请看我BLOG
http://blog.sina.com.cn/u/54c1567b010006bj
http://blog.sina.com.cn/u/54c1567b010006bj