Application cannot create log file in UNIX?

孤街醉人 提交于 2019-12-25 15:41:20

问题


I have developed a web project. Which is generating log file using log4j. But the same application is deployed in UNIX, it is not able to create log file also..
I'm new to unix. Why it is not creating log file? This is the code....

log4j.rootLogger = INFO,CA, FA

#Console Appender
log4j.appender.CA = org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout = org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern =  %d  %5p %c{1}:%L - %m%n

#File Appender
log4j.appender.FA = org.apache.log4j.FileAppender
log4j.appender.FA.File =correspondence.log
log4j.appender.FA.layout = org.apache.log4j.PatternLayout
log4j.appender.FA.layout.ConversionPattern = %d  %5p [%t] - %m%n

It is creating log file in server installation folder. But not creating in UNIX.. Any changes I have to do?


回答1:


try changing the line:

log4j.appender.FA.File =correspondence.log

to:

log4j.appender.FA.File = /tmp/correspondence.log

If it works, then create a log dir in the home directory of the user running the application server, chmod it at least to be executable and writable by owner and then put the log in that directory.



来源:https://stackoverflow.com/questions/11115141/application-cannot-create-log-file-in-unix

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!