File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logs not getting created

 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1211
IntelliJ IDE Mac
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic