File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Enable Logging in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Enable Logging in Tomcat" Watch "Enable Logging in Tomcat" New topic
Author

Enable Logging in Tomcat

rini john
Greenhorn

Joined: Mar 13, 2011
Posts: 7
Hi,

I am using Tomcat 5.0 version, i am not able to activate logging information.

i have done the following configuration in server.xml then also logs are not generated.

<Valve className="org.apache.catalina.valves.AccessLogValve"

* directory="logs" prefix="localhost_access_log." suffix=".log"

pattern="common" resolveHosts="false"/>

Kindly help....!!!1

Regards,
Rini John
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
Where exactly did you do the change in server.xml ?

Why do you have an asterisk in



rini john
Greenhorn

Joined: Mar 13, 2011
Posts: 7
Inside the host tag, details of which are given below

<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<Valve className="org.apache.catalina.valves.AccessLogValve"

directory="logs" prefix="localhost_access_log." suffix=".log"

pattern="common" resolveHosts="false"/>

<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="log_whatever-access." suffix=".txt"
timestamp="true"/>

</Host>

the asterik sign was mistakenly given....

Is there any difference in configuration done for logging in Tomcat 5.0 or later one's.

Regards,
Rini John
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
It should work. May be you have the permissions issues with "logs" directory. What does regular log say?
rini john
Greenhorn

Joined: Mar 13, 2011
Posts: 7
no log is generated.....
rini john
Greenhorn

Joined: Mar 13, 2011
Posts: 7
In Tomcat 5.0 for logging is there need to keep log4j.jar in lib folder of CATALINA_HOME?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16308
    
  22

rini john wrote:In Tomcat 5.0 for logging is there need to keep log4j.jar in lib folder of CATALINA_HOME?


No, and you're probably safer not to do so. Please note that logging for webapps and logging for Tomcat itself are 2 entirely different things, though. The Tomcat docs on logging refer to how Tomcat logs itself. Webapps are responsible for their own logging.

Tomcat 5.0 is really obsolete now. You should consider moving to Tomcat 5.5.28 or Tomcat6.


Customer surveys are for companies who didn't pay proper attention to begin with.
Rushikesh Pisal
Greenhorn

Joined: Mar 28, 2011
Posts: 7
Hello,

i m using tomcat 5.0 currently n i want disable log of tomcat because it prints below message on my console.
i want to remove below message from my console

Mar 28, 2011 4:03:12 PM org.apache.catalina.startup.Embedded start
INFO: Starting tomcat server
Mar 28, 2011 4:03:13 PM org.apache.catalina.core.StandardEngine start

INFO: Starting Servlet Engine: Apache Tomcat/5.0.28
Mar 28, 2011 4:03:13 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Mar 28, 2011 4:03:15 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-192.195.172.168-3048
Mar 28, 2011 4:03:15 PM org.apache.coyote.http11.Http11Protocol start

INFO: Starting Coyote HTTP/1.1 on http-192.195.172.168-3048
Mar 28, 2011 4:03:15 PM org.apache.catalina.core.StandardHost getDepl

INFO: Create Host deployer for direct deployment ( non-jmx )
Mar 28, 2011 4:03:15 PM org.apache.catalina.core.StandardHostDeployer
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16308
    
  22

Rushikesh Pisal wrote:Hello,

i m using tomcat 5.0 currently n i want disable log of tomcat because it prints below message on my console.
i want to remove below message from my console

Mar 28, 2011 4:03:12 PM org.apache.catalina.startup.Embedded start
INFO: Starting tomcat server
Mar 28, 2011 4:03:13 PM org.apache.catalina.core.StandardEngine start

INFO: Starting Servlet Engine: Apache Tomcat/5.0.28
Mar 28, 2011 4:03:13 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Mar 28, 2011 4:03:15 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-192.195.172.168-3048
Mar 28, 2011 4:03:15 PM org.apache.coyote.http11.Http11Protocol start

INFO: Starting Coyote HTTP/1.1 on http-192.195.172.168-3048
Mar 28, 2011 4:03:15 PM org.apache.catalina.core.StandardHost getDepl

INFO: Create Host deployer for direct deployment ( non-jmx )
Mar 28, 2011 4:03:15 PM org.apache.catalina.core.StandardHostDeployer


Please don't post questions multiple times. It confuses people. You asked this as a stand-alone question, and that's where I hope people will go to answer it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enable Logging in Tomcat