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 "Koes, Derrick" <De...@Smith-Nephew.com> on 2002/07/31 18:15:50 UTC

RE: log4j in tomcat

The long-winded answer was fine and helpful.  That's what I wanted to know,
but there is a bit more.

Actually, I haven't modified either of the bat files you mention.

I simply followed option 1 in the log4j short manual for logging in tomcat
4.x.  This follows:

Default Initialization under Tomcat
The default log4j initialization is particularly useful in web-server
environments. Under Tomcat 3.x and 4.x, you should place the
log4j.properties under the WEB-INF/classes directory of your
web-applications. Log4j will find the properties file and initialize itself.
This is easy to do and it works. 

You can also choose to set the system property log4j.configuration before
starting Tomcat. For Tomcat 3.x The TOMCAT_OPTS environment variable is used
to set command line options. For Tomcat 4.0, set the CATALINA_OPTS
environment variable instead of TOMCAT_OPTS. 



-----Original Message-----
From: Charles N. Harvey III [mailto:charlieh@alloy.com] 
Sent: Wednesday, July 31, 2002 10:01 AM
To: Tomcat Users List
Subject: RE: log4j in tomcat

I think I know what the problem is.  To add log4j to Tomcat you added an
extra parameter to either startup.bat or catalina.bat right?  (I can't
remember which one.)  So when you start Tomcat from the start menu it
reads the change you made in the file.

Thing is, when Tomcat starts as a service it DOES NOT read that change
that you made.  Doh!  Here's why.  The installer creates the service like
any other service gets made - with the command prompt.  That's what the
tomcat.exe file is for in your /bin directory.  It does not run Tomcat,
it installs it as a service.  But, it installs with the same set of
parameters
as in the original (catalina|startup).bat file.

So what has to be done is that you must remove the Tomcat service and
re-install it all from the command prompt.  And here is a link to a web
page made by some really nice people that know more about it than me.

http://www.alexandriasc.com/software/JavaService/index.html

They have made a seperate file called JavaService.exe to run the command
against instead of Tomcat.exe.  The documentation page on that site explains
how to install everything and all the parameters you can set.

The only thing not explained is how to remove the Tomcat Service.
	> Tomcat.exe -uninstall "Service Name"
(Enter the exact name, with spaces, that you see in the services menu.

The command you enter will look something like this - take note of the log4j
part:

 > "%CATALINA_HOME%\bin\tomcat.exe" -install "Apache Tomcat"
"%JAVA_HOME%\jre\bin\hotspot\jvm.dll"
-Dlog4j.configuration=/WEB-INF/conf/log4j.properties
-Djava.class.path="%CATALINA_START%" -Dcatalina.home="%CATALINA_HOME%" -Xrs
-start org.apache.catalina.startup.Bootstrap -params start
-stop org.apache.catalina.startup.Bootstrap -params stop
-out "%CATALINA_HOME%"\logs\stderr.log

Yeah, long.  But if you look at your (startup|catalina).bat file it will
look
similar.

Hope this answers your questions - I know my answers are long winded.

Charlie



> -----Original Message-----
> From: Koes, Derrick [mailto:Derrick.Koes@Smith-Nephew.com]
> Sent: Wednesday, July 31, 2002 8:40 AM
> To: 'Tomcat Users List'
> Subject: log4j in tomcat
>
>
> If I start Tomcat as an NT service I get the WARNings that no log4j
> appenders could be found.
>
> If I start Tomcat from the start menu everything works as
> expected and I get
> my logs.
>
>
>
> Has anyone seen this behavior?
>
> Is there an explanation?  I'm guessing some kind of timing issue.
>
>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>