tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian McGovern" <>
Subject RE: [RESOLVED] not found in tomcat
Date Tue, 22 Feb 2005 20:28:34 GMT
Then theres something else going on.  I didnt set log4j.configuration  when i started, i just
had my log4j.jar in my WEB-INF/lib/ and my in my /WEB-INF/classes/  However
i still got that file not found exception.  

I think its gotta either the way im calling it or the properties file itself.  I say this
because ive now tried on 2 machines 2 OS's and same thing happened.  It MAKES me define a
system wide log4j.configuration.  This cannot be right.  Makes the whole use of log4j pointless
and non portable.  

At any rate, ive got that wacky system-wide var defined and it supresses errors, just doesnt
work the way i want.

Calling like this:
private static final Logger zLogger = Logger.getLogger(RepsMainController.class);
zLogger.debug("something logged here"); like this:
log4j.rootLogger=DEBUG, nycbbuilderlog
log4j.appender.nycbbuilderlog.layout.ConversionPattern=%5p [%d{MM-dd-yyyy@HH:mm:ss,SSS}] -

-----Original Message-----
From: Jacob Kjome []
Sent: Tuesday, February 22, 2005 3:01 PM
To: Tomcat Users List
Subject: RE:[RESOLVED] not found in tomcat

Quoting Brian McGovern <>:

> Thanks for the repliess.  My issue was that I needed to set a system wide
> environment variable called log4j.configuration and set its value to
> "", the name of my config file for log4j.  This was in the
> log4j documentation but I guess i skimmed over that part.  Log4j is a
> application completely separate from web container, hence the need for a
> system wide var.  Definately liking log4j more and more.
> My file was located in my /webapps/myappuri/WEB-INF/classes/  So the answer
> turns out that log4j looks for a system env var log4j.configuration and looks
> in your webapps class path for it.

No, I'm pretty sure this is not the case.  log4j.configuration does not need to
be specified.  If it is, I believe it is assumed to be a file location.  If
relatively defined, it is resolved relative to the location that the JVM
started.  If not defined, Log4j looks in the classloader.  Actually, I haven't
checked, but it may fall back to the classloader if it can't find the log4j
config file in the location specified by the system property.  You'll have to
verify that.

> Additionally I set up tomcat to use my log4j file as well by makin a file
> called in /webapps/myappuri/WEB-INF/classes/ whos
> only line was:
> org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
> Note that commons-logging.jar needs to be in your
> /webapps/myappuri/WEB-INF/lib/ dir for this to work.

If you want Log4j to be a system-wide service, you should really add log4j.jar
and commons-logging.jar to CATALINA_HOME/common/lib and add to
CATALINA_HOME/common/classes.  There is no need for the file in that case.  And it is kludgy to provide
server-level properties inside a webapp.  BTW, do you have log4j.jar in your
WEB-INF/lib?  If so, you are simply logging for your webapp alone, not


> Thanks
> -B
> -----Original Message-----
> From: Jacob Kjome []
> Sent: Tuesday, February 22, 2005 12:30 AM
> To: Tomcat Users List
> Subject: Re: not found in tomcat
> You have to understand that any relative path is going to be resolved
> relative to the location where the JVM started.  If you started Tomcat via
> the service rather than the batch files, then the VM would be run, by
> default, from C:\winnt\System32.  So, when you supplied
> "", you got exactly what should be
> expected if were located in c:\winnt\System32.  Same goes
> for relatively defined paths to log files defined for FileAppenders in
> BTW, can you post your error?   FileNotFoundExceptions aren't thrown when
> Log4j can't find its config file.  You'd get a simple error saying as
> much.  The FileNotFoundExceptions are usually thrown when you specify a
> file for a FileAppender in a directory that doesn't exist.  Log4j makes no
> attempt to create directories if they don't exist already.  This is the
> correct and safe thing to do.  It is your responsibility to make sure the
> directory exists before Log4j attempts to use it.
> Jake
> At 11:09 PM 2/21/2005 -0500, you wrote:
>  >Where do you put currently?
>  >-Michael Greer
>  >
>  >On Feb 21, 2005, at 5:02 PM, Brian McGovern wrote:
>  >
>  >> I have a wierd problem.  Tomcat on W2k barks FileNotFound Exceptions
>  >> for the file when i execute a servlet that
>  >> instantiates log4j.  Strangely enough the actual file that i create
>  >> and log to with file logs out just fine even though
>  >> stdout.log said that it couldn't find my file.
>  >>
>  >> Only time i don't get an error is when i put log4j.properites in my
>  >> winnt/system32 directory.  But this doesnt make sense to me.  I supply
>  >> to Java at startup and still
>  >> get the same error.  I also tried the FULL path to my
>  >> in the -D option.
>  >>
>  >> Instantiated like this across my app.
>  >>
>  >> private static final Logger zLogger =
>  >> Logger.getLogger(MyClassName.class);
>  >>
>  >> Can anyone tell me where I went wrong.
>  >>
>  >> thanks
>  >
>  >
>  >---------------------------------------------------------------------
>  >To unsubscribe, e-mail:
>  >For additional commands, e-mail:
>  >
>  >
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message