How can I retain existing log file permissions with Log4J DailyRollingFileAppender
I have a jar file which internally use log file to write messages. Using this jar I have developed a Perl module. The usage of this module is across out firm. So I have given 666
permissions on all the log files 开发者_运维知识库so that everyone can use the module. The issue is the jar file internally uses log4j and the appender is DailyRollingFileAppender
which is resetting the permissions on the log files to 664
after rolling and certain people are not able to use the module.
Is there a way to mention to log4j to retain the existing permissions of the log file ? If not, can anyone suggest alternative ?
This is the responsibility of the operating system. When Log4j rolls a log, the OS will create that new file according to its own rules.
You should be able to reproduce this manually, by opening a shell in the log directory and running touch testfile
- the file testfile
should exhibit the same permissions as new log4j files.
You need to look at the file permissions on the directory, those that are inherited by new files in that directory. You may also need to tinker with the user's umask
setting.
If you can reproduce the problem without using log4j or java, then it becomes easier to solve, but would be best asked on superuser.com.
精彩评论