This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
This (big surprise) doesn't seem to be an issue at all on Windows, but on Linux (Slack 9) I can't get my log4j to work unless I do this:
chmod +777 my_debug_log.log
What's the minimum set of read/write permissions needed for log4j in a webapp environment? If I have this file inside /WEB-INF/logs/ shouldn't that file pickup the permissions/whatnot of its containing folders? When I start Tomcat as 'nobody' will log4j run as this user (for purposes of file permissions?)
Is there a big gap in my Unix file/directory permissions knowledge? (Ok, the answer to that last one is probably yes)
Yes, log4j will be using the permissions for nobody. Write permissions on Unix are based on Owner and Owner group. So it actually depends on who owns the directory /WEB-INF/logs. When you do a ls -al the permissions for the files and directories are list Example: drwxrwxrwx 2 root root 4096 Sep 9 05:38 . drwxrwxr-x 11 root root 1024 Apr 2 08:16 .. -rwxrwxrwx 1 root root 2003803 Sep 10 18:03 catalina.out From left to right, d stands for of all things directory. The next 3 rwx means the Owner (root) has read write and execute permission. Next three are for members of the same group and the last three for everyone else. Check to see who owns the logs directory and what permissions are on it you souldn't need more than rw for all three (666) actually better is to change the owner (chown) of the logs directory to nobody and change the permissions to 644. Once you have that, log4j should be able to log in that directory and create ehatever files it needs. I'd recommend the RollingFileAppender or the DailyFileAppender (I think that's the name one of those lookup things)