问题描述
对所有人来说都是美好的一天.
我问一个问题,出于居民的态度,这似乎也是一个愚蠢的问题.
这是我的log4j.properties文件,该文件将很快在生产中.
log4j.rootcategory = info,a1
A1是Dailyrollingfileappender
log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A1.file=D:/MyWEBLogs/MyWEB.log
log4j.appender.A1.datePattern='.'yyyy-MM-dd
log4j.appender.A1.append=true
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-22d{dd/MMM/yyyy HH:mm:ss} - %m%n
您可以看到我在此处提到的文件路径是d:/myweblogs/myweb.log. (这在Windows环境下正常工作)
但是我们的应用程序将被视为战争文件,并在Linux环境内部部署在Tomcat内部.
在Linux Enviremnt内部,我们不确定该路径(这是该tomcat所在的路径...),作为用户,我们获得了有限的权限,喜欢创建文件-----------等等
现在我的问题是,什么应该是最佳的默认路径,因此在Linux Enviremnt中的任何位置都可以在Linux Enviremnt中运行,无论其放置在哪里
log4j.appender.A1.file=D:/MyWEBLogs/MyWEB.log
推荐答案
应该是${user.home}/appName/MyWEB.log,用户通常有权在家中写入dir
问题描述
a very good day to all .
I am asking a question , out of curisioty , may be this seem to be a foolish question also .
This is my log4j.properties file for a Application which will be in production very soon .
log4j.rootCategory=Info, A1
A1 is a DailyRollingFileAppender
log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender log4j.appender.A1.file=D:/MyWEBLogs/MyWEB.log log4j.appender.A1.datePattern='.'yyyy-MM-dd log4j.appender.A1.append=true log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%-22d{dd/MMM/yyyy HH:mm:ss} - %m%n
As you can see the file path i have mentioned here is D:/MyWEBLogs/MyWEB.log . (This works fine under Windows Environment )
But our Application will be taken as a war file and deployed inside Tomcat inside Linux Environment .
Inside Linux Environemnt , we are not sure about the path (That is whaere this tomcat resides there ...) and also as a user we have got limited permissions , like to create a file ---etc
So now my question is , what should be the best default path to be put in below line , so taht it runs anywhere in linux Environemnt , no matter where it is placed
log4j.appender.A1.file=D:/MyWEBLogs/MyWEB.log
推荐答案
should be ${user.home}/appName/MyWEB.log , user generally has right to write in home dir