Thanks.

It worked.  All the examples I had seen online had just the logfile name
without a path, so I figured I would search for it once it was started and
just "wait and see" where it appeared.  It never appeared.

I tried the full path and voila, it is right where I told it to be.

Agh!

Thanks again.

-----Original Message-----
From: Steve Ebersole [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 6:44 PM
To: Log4J Users List
Subject: Re: Log4j is not creating log file for RollingFileAppender


Where are you expecting this file to show up?  I mean in what directory?  I
am not sure how Tomcat works, but specifying relative file paths can have
extremely unintuative results.  Try a full path and see if that works.

Or try searching your file system for a file named admin.log to see if it
might just be getting created in a plave you did not expect.


----- Original Message -----
From: "Shawn Smith" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 28, 2003 4:23 PM
Subject: Log4j is not creating log file for RollingFileAppender


> I am using Tomcat/4.1.12 and trying to initialize Log4j with a properties
> file and java servlet.  It logs just fine to the console and when starting
> up it appears to load the properties file without error, but it never
> creates the log file (admin.log).  My properties file is stored in the
> WEB-INF/classes folder.
>
> I can get it to create the log file by programmatically configuring log4j,
> but I would like to get away from that.
>
> Anybody have any ideas?
> Does anybody know where it would create this file by default?
>
> Thanks in advance,
>
> Shawn Smith
> ------------------------------------
> Here is my properties file:
>
> #start
> log4j.rootLogger=debug, stdout, cadtutorOut
>
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
>
> log4j.appender.cadtutorOut=org.apache.log4j.RollingFileAppender
> log4j.appender.cadtutorOut.File=admin.log
> log4j.appender.cadtutorOut.MaxFileSize=100KB
> log4j.appender.cadtutorOut.MaxBackupIndex=1
> log4j.appender.cadtutorOut.layout=org.apache.log4j.PatternLayout
> log4j.appender.cadtutorOut.layout.ConversionPattern=%p %t %c - %m%n
>
> log4j.category.org.apache.torque=debug, cadtutorOut
>
> log4j.category.com.cadtutor=debug, cadtutorOut
> #end
>
>
> Loaded with a initialization servlet (copied directly from the log4j
> manual):
> //start
> package com.cadtutor.controller;
>
> import org.apache.log4j.PropertyConfigurator;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> import java.io.PrintWriter;
> import java.io.IOException;
>
> public class Log4jInit extends HttpServlet {
>
>   public
>   void init() {
>     String prefix =  getServletContext().getRealPath("/");
>     String file = getInitParameter("log4j-init-file");
>     System.out.print("Getting log4j.properties from "+prefix+file);
>     // if the log4j-init-file is not set, then no point in trying
>     if(file != null) {
>       PropertyConfigurator.configure(prefix+file);
>     }
>   }
>   public
>   void doGet(HttpServletRequest req, HttpServletResponse res) {
>   }
> }
> //end
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to