aspose file tools
The moose likes Other Open Source Projects and the fly likes How to make Jetty use Log4j Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "How to make Jetty use Log4j" Watch "How to make Jetty use Log4j" New topic
Author

How to make Jetty use Log4j

banuchithra chithra
Greenhorn

Joined: Oct 04, 2005
Posts: 3
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

Joined: Oct 04, 2005
Posts: 3
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.
 
 
subject: How to make Jetty use Log4j
 
Threads others viewed
Multiple log4j configurations in a single classloader ?
ejb and web app. logging with log4j
Can Log4j read two properties?
Logging in Tomcat 5
IntelliJ and Jetty - plugin available?
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture