• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to set up commons logging?  RSS feed

 
rick collette
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I am using commons logging to do debugging:

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

I can debug as the following:
private static Log log = LogFactory.getFactory().getInstance(
myClass.class);

log.debug(...);

The problem is how I can set up (e.g., a logging location
which has a file)and check the debugging results?

regards,
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The deal with jakarta commons-logging (JCL) is that it uses whatever underlying configuration files it can get it's greedy paws on.

So, for example, if you put log4j.jar in your classpath, and supplied a log4j config file, then JCL will use that configuration (as best it can).

I'm a huge fan of log4j myself, so I'd recommend that package.

If you don't want to use that, and if you're using JDK1.4, then JCL will attempt to use the logging config the the jdk's java.util.logging package. I've never used that one, but I understand you can configure it a number of different ways. Not sure if you can do so *through* JCL though (probably not though).

finally, if you don't have log4j or jdk1.4, you get down to JCL's SimpleLogger, which it looks like you have to configure through system properties? That doesn't seem right though.

I found all this by :
http://jakarta.apache.org/commons/logging/guide.html#Configuration
file:///C:/jdk142_03/docs/guide/util/logging/overview.html
(sorry, no web link for that one, but you should be able to puzzle one out).

I should make it clearer too: I meant by recommending using log4j that you use log4j exclusively, without wrapping it in commons-logging.

Finally, this is not really a Apache (web server) or Tomcat question, so I'll move this to 'Other Java APIs'
[ June 03, 2004: Message edited by: Mike Curwen ]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!