• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to make Jetty use Log4j

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I would like to know how Jetty can be made to use log4j for logging from JSP pages and for request logging.

I do not want to instantiate Logger in my JSP pages and use logger.log(blah blah blah..) as most of our pages are already with our customers.

Currently Jetty uses its default logging mechanism(org.mortbay.util.Log). So we simply use
log("message");

and this gets appended to the log file specified in the etc/jetty.xml file.

I would like to override this logging with Log4j. I tried the following to no effect:
1) Made a copy of log4j.jar under $JETTY_HOME/ext
2) Commented out logging related lines from the config file etc/jetty.xml
3) Have a log4j.properties file with FileAppender under etc directory
4) Tried starting Jetty with

java -Dorg.mortbay.log.LogFactory.noDiscovery=false -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger -Dlog4j.configuration=etc/log4j.properties
-Dlog4j.debug=true -jar start.jar etc/jetty.xml

Still the log messages get thrown on the console and the specified log file does not get created.

I searched on jetty mailing list and went through jetty's logging tutorial
http://jetty.mortbay.org/jetty/tut/logging.html to no effect.

I don't want to upgrade to JettyPlus, unless that is the ONLY way to use log4j. Thank you for any help in this regard.

Banu
 
banuchithra chithra
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Nobody seems to know how to proceed. This is what I have done now...

1) Instantiate the logger in each page.
2) Use logger.debug(blah blah..);

Please do let me know if there are any other approaches. Thank you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic