[logback-user] Log file permissions

Hontvári József hontvari at flyordie.com
Mon Mar 8 14:43:03 CET 2010


I found it out immediately when I started to edit the source to insert 
the test code you asked. The code is running with the help of the Apache 
Commons Daemon jsvc *nix wrapper and the different file permissions are 
the consequences of the way jsvc works. The OS is Ubuntu 9.10.

The jsvc wrapper does two phase initialization. In the "init" method it 
runs with root privileges (but under the real uid specified in the 
command line?), then in the "start" method it has already dropped root 
privileges and in addition it called umask. The result is below. Logback 
is initialized with the starting class, so it runs in the same 
environment than the first test FileWriter in the init method. And 
indeed both the log file and the test file are readable only by the 
specified user. The file created by the second test FileWriter, which 
runs in the second, start method, after the umask was called, is 
readable by group and others.

Thank you for the help.

/var/log/jddclient/
drwxr-s---  2 jddclient adm  4096 2010-03-08 13:29 .
drwxr-xr-x 15 root      root 4096 2010-03-08 13:29 ..
-rw-------  1 jddclient adm  2525 2010-03-08 13:29 jddclient
-rw-------  1 jddclient adm    12 2010-03-08 13:29 test-init
-rw-r--r--  1 jddclient adm    12 2010-03-08 13:29 test-start


Ceki Gülcü írta:
>
>
> Logback does not do anything special with respect to file
> permissions. It just opens a file (creates if not existent). Does
> logback's behavior with respect file permissions differ from a file
> created by "FileWriter fr = new FileWriter("x")" ?
>
> Which operating system are you using?
>
> On 08/03/2010 1:11 PM, Hontvári József wrote:
>> I cannot discover why the log file created by logback has different
>> permissions then another file created by the same Java process. I don't
>> see anything special in Logback code, do I miss something? The log file
>> is only readable by the user running the process.
>>
>> /var/lib/jddclient
>> drwxr-s--- 2 jddclient adm 4096 2010-03-08 12:24 .
>> drwxr-xr-x 58 root root 4096 2010-03-08 12:23 ..
>> -rw-r--r-- 1 jddclient adm 103 2010-03-08 13:04 status.xml
>>
>> /var/log/jddclient
>> drwxr-s--- 2 jddclient adm 4096 2010-03-08 12:24 .
>> drwxr-xr-x 15 root root 4096 2010-03-08 12:25 ..
>> -rw------- 1 jddclient adm 9811 2010-03-08 13:04 jddclient
>>
>>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
>




More information about the Logback-user mailing list