logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James A. N. Stauffer" <stauffer.ja...@gmail.com>
Subject Re: log4j directory creation
Date Tue, 25 Mar 2008 14:52:28 GMT
Log4j appenders don't create directories.  An appender that I ahve
written does create directories or you could create your own appender.

http://stauffer.james.googlepages.com/DateFormatFileAppender.java

On Tue, Mar 25, 2008 at 5:54 AM, Sairam Krishnamurthy
<skrishnamurthy@spikesource.com> wrote:
>
>  Hi,
>
>  I tried to use log4j for my application. I am new to log4j and at first I
> created a new application to get familiar with log4j. The following is the
> appender's properties in log4j.property file.
>
>  log4j.appender.A2=org.apache.log4j.FileAppender
>  log4j.appender.A2.File=c:/demo1/demo2/app.log
>  log4j.appender.A2=org.apache.log4j.RollingFileAppender
>  # Append to the end of the file or overwrites the file at start.
>  log4j.appender.A2.Append=true
>  log4j.appender.A2.layout=org.apache.log4j.PatternLayout
>  log4j.appender.A2.layout.ConversionPattern=[%5p] %d{mm:ss}
> (%F:%M:%L)%n%m%n%n
>
>  A2 is the logger appender i use. I dint have demo1/demo2 folder in C:. When
> i used this log4j configuration in my sample application it was a success
> with demo1/demo2 folder created by log4j.
>
>  But when i tried to use the same configuration in my application it gives
> the following error.
>
>  log4j:ERROR setFile(null,true) call failed.
>  java.io.FileNotFoundException: test\app.log (The system cannot find the
> path specified)
>  at java.io.FileOutputStream.openAppend(Native Method)
>  at java.io.FileOutputStream.<init>(Unknown Source)
>  at java.io.FileOutputStream.<init>(Unknown Source)
>  at org.apache.log4j.FileAppender.setFile(FileAppender.java:282)
>  at
> org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:165)
>  at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:161)
>  at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:256)
>  at
> org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:132)
>  at
> org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)
>  at org.apache.log4j.PropertyConfigurator
>
>  Also when i changed the filename = "app.log" with no folder name, the log
> file is creating in my source folder. So the problem was with the creation
> of directory.
>
>  Can somebody help me in this?
>
>  Thanks in advance.
>
>
>  --
>  ==================================
>  Sairam Krishnamurthy
>  Engineer-Platform
>
>  Email: skrishnamurthy@spikesource.com
>  Phone: +91-44-45544660
>              +91-80-41810800
>              +91-9840194528
>              +91-9916420081
>              +1-650-204-9766
>  IM: kmsram420@yahoo.co.in
>
>  Address
>  Diamond Business Park,
>  First Floor,
>  17 A Kalakshetra Road,
>  Tiruvanmiyur,
>  Chennai - 600 041.
>  ==================================
> ==



-- 
James A. N. Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
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