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