This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Logs not getting created Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Logs not getting created" Watch "Logs not getting created" New topic
Author

Logs not getting created

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

This must be easy, and I am sure I have done itbefore, but can't find thsi now.

I am working on few classes that would be used by servlets, these classes use logging feature. I am using -

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

Whe I test them as standalone classes, the logs show up on the console, but while running through the servlets, these logs are not getting saved under "tomcat/logs" directory. Where & how can I specify that the logs should go under "logs"???

TIA,
- Manish
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Manish,

Commons Logging is just a think wrapper around the underlying logging API, usually it is LOG4J or in case of Java 1.4, the java.util.logging package, so that is where you have to configure your logging.

You may need to look up how to do it for your setup, but by default the loggers are only assigned a Console handler, you have to add a File handler that will write to the location you want.

If you are using standard Java logging, this may help -
http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/overview.html

HTH


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

I am using log4j I beliveve. can you pint out how can I do this?
All the system.out.println are getting written to the log file correcly. Only my log.info() log.error() are not getting written I wonder why???

- Manish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Logs not getting created