Bug 40407 - log4j can't set permission of log file
Summary: log4j can't set permission of log file
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Appender (show other bugs)
Version: unspecified
Hardware: All Linux
: P2 normal
Target Milestone: ---
Assignee: log4j-dev
Keywords: APIBug, FAQ, JDK1.5
Depends on:
Reported: 2006-09-04 09:13 UTC by Yongliang Ai
Modified: 2007-01-28 04:22 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Yongliang Ai 2006-09-04 09:13:53 UTC
When log4j initialization, it create log file will system defalut permission, 
such as "-rw-r--r--". But if other user use the application, he can't write 
any thing into log file. Log4j should add a property to set the permission of 
log file.
Comment 1 Curt Arnold 2006-09-13 20:08:13 UTC
Any suggestions how that could be achieved in a reasonable manner.  As far as I can tell, the Java runtime 
libraries provide no mechanism for specifying or modifying file permissions other than invoking a native 
method or executing a program.
Comment 2 Kay Abendroth 2006-11-11 16:59:33 UTC
To quote http://www.jguru.com/faq/view.jsp?EID=19558:
"The proper way on Unix machines to do this is to set the userMask to the
desired value. When JVM is run on Unix box it takes the file permissions from
the value of userMask."

This bug should be marked WONTFIX, since there's no way for log4j to set
non-fileowner-permissions, except calling external programs.

It's up to the host OS to setup these permissions. This should be mentioned in
the documentation.