logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Kjome" <h...@visi.com>
Subject Re: getting error log4j:ERROR setFile(null,true) on windows
Date Tue, 20 Jul 2010 15:50:51 GMT
Does the "logs" directory exist relative to the base directory (i.e., the 
directory from which the application was started)?  I know it was an issue in 
older Log4j versions that it wouldn't make directories.  I'm not sure if this 
was addressed in later versions or not?  But you can avoid this by ensuring 
that the directory you want the file to exist within already exists prior to 
application startup.

Jake

On Tue, 20 Jul 2010 19:28:26 +0530
  sasanka pusapati <spusapatinlr@gmail.com> wrote:
> Hi All,
>             I am getting the "file not found exception" error when running
> my application using the below properties file .
> Why is log4j unable to create the logs directory on its own? This problem is
> seen only on windows , its working fine on linux.
> Can some one please help me on this.
> ------------------------------------------------------------------------------------------------------------------------------------
> Error :
> 
> log4j:ERROR setFile(null,true) call failed.
> java.io.FileNotFoundException: logs\test.log (The system cannot find the
> path sp
> ecified)
>        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)
> -----------------------------------------------------------------------------------------------------------------------------------------
> 
> 
> 
> ------------------------------------------------------------------------------------------------------------------------------------------
> log4j Properties file invoked using PropertyConfigurator.configure :
> 
> log4j.rootLogger = debug ,console ,logfile
> 
> log4j.appender.console=org.apache.log4j.ConsoleAppender
> log4j.appender.console.layout=org.apache.log4j.PatternLayout
> log4j.appender.console.layout.ConversionPattern=%d{M/dd/yy hh:mm:ss.SSS a z}
> [%-3p] [%t] [%c] %m%n
> 
> 
> log4j.appender.logfile=org.apache.log4j.RollingFileAppender
> log4j.appender.logfile.File=logs/test.log
> log4j.appender.logfile.MaxFileSize=2048KB
> log4j.appender.logfile.MaxBackupIndex=3
> log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
> log4j.appender.logfile.layout.ConversionPattern=%d{M/dd/yy hh:mm:ss.SSS a z}
> [%-3p] [%t] [%c] %m%n
> 
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------
> 
> 
> Thanks in advance,
> SAS.


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


Mime
View raw message