You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jacob Kjome <ho...@visi.com> on 2005/11/27 00:11:13 UTC

Re: Permission denied, log4j from IntelliJ Idea w/Tomcat, log4j:ERROR setFile(null,true) call failed

Looks to me like the Log4j config is pointing to a file at 
"/email.log".  It is unlikely that the Tomcat user has permissions to write 
to the root of the file system.  Point the log file to another location.

Jake

At 01:52 PM 11/26/2005 -0800, you wrote:
 >This is not my setup, but I'm charged with getting it to work.  Can
 >someone help?  I'm moving from a Windows host to Linux, and I get
 >permission errors writing the logs.
 >
 >I can't figure out what the current directory is at the time of the
 >failed call, and I'm not sure what process is running either.  Any
 >hints?  Is there a way to make this error message a bit more transparent?
 >
 >Here's the start of the log file:
 >
 >-----------------------------------------------------------------
 >/usr/share/tomcat5/bin/catalina.sh run
 >Using CATALINA_BASE:
 >/home/bryce/.IntelliJIdea50/system/tomcat_Tomcat_b826af2c
 >Using CATALINA_HOME:   /usr/share/tomcat5
 >Using CATALINA_TMPDIR: /usr/share/tomcat5/temp
 >Using JAVA_HOME:       /usr/lib/jvm/java-1.4.2-sun
 >Nov 26, 2005 1:31:43 PM org.apache.coyote.http11.Http11Protocol init
 >INFO: Initializing Coyote HTTP/1.1 on http-8080
 >Nov 26, 2005 1:31:44 PM org.apache.catalina.startup.Catalina load
 >INFO: Initialization processed in 2587 ms
 >Nov 26, 2005 1:31:44 PM org.apache.catalina.core.StandardService start
 >INFO: Starting service Catalina
 >Nov 26, 2005 1:31:44 PM org.apache.catalina.core.StandardEngine start
 >INFO: Starting Servlet Engine: Apache Tomcat/5.0
 >Nov 26, 2005 1:31:44 PM org.apache.catalina.core.StandardHost start
 >INFO: XML validation disabled
 >Nov 26, 2005 1:31:44 PM org.apache.catalina.core.StandardHost getDeployer
 >INFO: Create Host deployer for direct deployment ( non-jmx )
 >Nov 26, 2005 1:31:44 PM org.apache.catalina.core.StandardHostDeployer
 >install
 >INFO: Processing Context configuration file URL
 >file:/home/bryce/.IntelliJIdea50/system/tomcat_Tomcat_b826af2c/conf/Catalina
 >/localhost/ROOT.xml
 >log4j:ERROR setFile(null,true) call failed.
 >java.io.FileNotFoundException: /email.log (Permission denied)
 >    at java.io.FileOutputStream.openAppend(Native Method)
 >    at java.io.FileOutputStream.<init>(FileOutputStream.java:177)
 >    at java.io.FileOutputStream.<init>(FileOutputStream.java:102)
 >    at org.apache.log4j.FileAppender.setFile(FileAppender.java:272)
 >    at
 >org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:156)
 >    at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:151)
 >    ....
 >-----------------------------------------------------------------
 >
 >
 >>>>> cat
 >/home/bryce/.IntelliJIdea50/system/tomcat_Tomcat_b826af2c/conf/Catalina/loca
 >lhost/ROOT.xml
 ><?xml version="1.0" encoding="UTF-8"?>
 ><Context path="" docBase="/mnt/hdb5/cvs/ccs/denali/exploded" />
 >
 >
 >---------------------------------------------------------------------
 >To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
 >For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Permission denied, log4j from IntelliJ Idea w/Tomcat, log4j:ERROR setFile(null,true) call failed

Posted by Jacob Kjome <ho...@visi.com>.
At 04:16 PM 11/26/2005 -0800, you wrote:
 >Ah, that's it.  I had assumed that was a relative path name.
 >But how do I set the default path?
 >AFIK the log file base is set to
 >     System.setProperty("log.dir", denaliHome + File.separator + "logs");
 >Where denaliHome is not "".
 >

What does the config file look like?  It's quite obvious that this system 
property is not being utilized since even if "denaliHome" was "" and the 
config file had the file path as "${log.dir}/email.log", the path would 
still be "/logs/email.log".  Do you know what config file the app is 
using?  If not, and if you don't have any control over the classpath, you 
can still set the URL to the config file by using the following on the 
command line when starting the server (how you get it in-line with the 
"java" command inside the script that bootstraps the server is 
server-specific, so you'll have to figure that out yourself)....

-Dlog4j.configuration=file:/path/to/config/file/log4j.xml

This way you guarantee that default initialization picks up the config file 
you expect it to.  Of course, if you are doing manual config, then you 
probably know which file is being configured.  Although, keep in mind that 
if defaut initialization finds a log4j config file, it will attempt to use 
it, even if later on you use manual configuration which is why I always 
suggest that one put a dummy basic log4j.xml file in the classpath to avoid 
unexpected behavior in default initialization when you are going to 
manually configure another config file.


Jake

 >Jacob Kjome wrote:
 >> Looks to me like the Log4j config is pointing to a file at
 >> "/email.log".  It is unlikely that the Tomcat user has permissions to
 >> write to the root of the file system.  Point the log file to another
 >> location.
 >>
 >> Jake


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Permission denied, log4j from IntelliJ Idea w/Tomcat, log4j:ERROR setFile(null,true) call failed

Posted by Bryce Nesbitt <br...@obviously.com>.
Ah, that's it.  I had assumed that was a relative path name.
But how do I set the default path?
AFIK the log file base is set to
     System.setProperty("log.dir", denaliHome + File.separator + "logs");
Where denaliHome is not "".

Jacob Kjome wrote:
> Looks to me like the Log4j config is pointing to a file at
> "/email.log".  It is unlikely that the Tomcat user has permissions to
> write to the root of the file system.  Point the log file to another
> location.
>
> Jake


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org