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 Naresh Agarwal <na...@yahoo.com> on 2003/10/07 13:40:22 UTC

log4j generated log file path

Hi

I'm using log4j in my web application, which is deployed in Tomcat. 

By default, log4j generates the log file user's directory i.e., "C:\Documents and Settings\drathi\Start Menu\Programs\Apache Tomcat 4.1".

How can I make log4j to generate this log file at some other place?

thanks,

Naresh   





---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

Re: log4j generated log file path

Posted by Jacob Kjome <ho...@visi.com>.
At 06:56 AM 10/7/2003 -0700, you wrote:
>log4j.appender.DISSLog.File=diss.log

That's the culprit.  Notice that you simply specified the log file 
name.  This is written out, as you've discovered, to a location relative to 
the directory where the JVM started.  Try using something like...

log4j.appender.DISSLog.File=C:\logs\diss.log

...or you can set a system property and reference that...

log4j.appender.DISSLog.File=${logfilelocation}/diss.log

I think that that works in property files?  I know it works in XML config 
files.


Jake


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


Re: log4j generated log file path

Posted by Naresh Agarwal <na...@yahoo.com>.
Hi Jake,
 
my property file looks as below :
 
-----------

# Root logger, uses appender by name of Log

log4j.rootLogger=INFO

log4j.logger.DISSLogger=INFO, DISSLog

log4j.additivity.logger.DISSLogger=false

# DISSLog appender, rolling file appender with file size 100KB, max 10 files

log4j.appender.DISSLog=org.apache.log4j.RollingFileAppender

log4j.appender.DISSLog.File=diss.log

log4j.appender.DISSLog.MaxFileSize=100KB

# Keep backup files

log4j.appender.DISSLog.MaxBackupIndex=10

log4j.appender.DISSLog.layout=org.apache.log4j.PatternLayout

log4j.appender.DISSLog.layout.ConversionPattern=%d [%t] %-5p - %C{1}::%M %m%n

------------

How can we specify directory for output of your FileAppender?
 
thanks,
Naresh
Jacob Kjome <ho...@visi.com> wrote:

That is where the JVM is started from and, hence, the location to which 
relatively specified files will be written. What does your config file 
look like? Have you specified a directory for output of your FileAppender?

Jake

At 04:40 AM 10/7/2003 -0700, you wrote:

>Hi
>
>I'm using log4j in my web application, which is deployed in Tomcat.
>
>By default, log4j generates the log file user's directory i.e., 
>"C:\Documents and Settings\drathi\Start Menu\Programs\Apache Tomcat 4.1".
>
>How can I make log4j to generate this log file at some other place?
>
>thanks,
>
>Naresh
>
>
>
>
>
>---------------------------------
>Do you Yahoo!?
>The New Yahoo! Shopping - with improved product search


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


---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

Re: log4j generated log file path

Posted by Jacob Kjome <ho...@visi.com>.
That is where the JVM is started from and, hence, the location to which 
relatively specified files will be written.  What does your config file 
look like?  Have you specified a directory for output of your FileAppender?

Jake

At 04:40 AM 10/7/2003 -0700, you wrote:

>Hi
>
>I'm using log4j in my web application, which is deployed in Tomcat.
>
>By default, log4j generates the log file user's directory i.e., 
>"C:\Documents and Settings\drathi\Start Menu\Programs\Apache Tomcat 4.1".
>
>How can I make log4j to generate this log file at some other place?
>
>thanks,
>
>Naresh
>
>
>
>
>
>---------------------------------
>Do you Yahoo!?
>The New Yahoo! Shopping - with improved product search


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