开发者

How to Configuring Logging in Jetty via config file?

开发者 https://www.devze.com 2022-12-10 00:22 出处:网络
How do I get jetty to turn down the level of logging from the default of INFO? I\'m actually trying to run the default Apache Solr installation, which ships with jetty, but dumps a lot of information

How do I get jetty to turn down the level of logging from the default of INFO?

I'm actually trying to run the default Apache Solr installation, which ships with jetty, but dumps a lot of information to the console, and I'd only like to see warnings.

I don't want to go hack 开发者_JAVA技巧up the code, I just would like to be able to drop a config file somewhere, but I've been googling for a while, and all I find are obsolete methods or programmatic methods.

Thanks!

edit: -D options would be great, too!


Short answer: java -DDEBUG -jar start.jar

Long answer: (taken from http://docs.codehaus.org/display/JETTY/Debugging)

"Jetty has it's own builtin logging facade that can log to stderr or slf4j (which in turn can log to commons logging, log4j, nlog4j and java logging). Jetty logging looks for a slf4j jar on the classpath. If found, slf4j is used to control logging otherwise stderr is used. The org.mortbay.log.Log class is used to coordinate logging and the following system parameters may be used to control logging:"

org.mortbay.log.class: Specify an implementation of org.mortbay.log.Logger to use

DEBUG: If set, debug logs will be produced, else only INFO and WARN logs will be generated

VERBOSE: If set, verbose logging is produced, including ignored exceptions

IGNORED: If set (jetty 6.1.10 and later), ignored exceptions are logged (independent of DEBUG and VERBOSE settings

Here I undestand that by the "system parameters", in the above cited text, they mean "Java system properties".


If you run jetty 6 as a daemon, the logging config file is:

/usr/share/jetty/resources/log4j.properties

(Where /usr/share/jetty is your $jetty.home.) And to turn down the default log level in that log4jproperties file, change the rootLogger entry:

log4j.rootLogger=WARN, stdout


Find the file logging.properties under your JAVA_HOME directory

Change the default global logging level from

.level= INFO

to

.level= WARNING

0

精彩评论

暂无评论...
验证码 换一张
取 消