Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Configuring Logging in Jetty via config file?

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 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!

like image 879
Log Me Out Avatar asked Oct 30 '09 03:10

Log Me Out


People also ask

How do I enable jetty logs?

You can configure Jetty Request logging by adding something similar to the following at the end of the jetty. xml file (located in the /path/to/idm/conf directory): IDM 6.5 and later: <Set name="requestLog"> <New id="RequestLog" class="org. eclipse.

What is Jetty logging?

last modified July 15, 2022. Logging is recording the activity of a program during its lifetime. Logging is used for problem diagnosis, auditing, debugging, or information gathering. There are several logging frameworks available in Java. If we do not specify a logging framework, Jetty defaults to its built-in org.

What is Jetty base?

Jetty's default configuration is based on two properties: jetty.home The property that defines the location of the jetty distribution, its libs, default modules and default XML files (typically start.jar, lib, etc) jetty.base The property that defines the location of a specific instance of a jetty server, its ...


2 Answers

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".

like image 197
Jiri Patera Avatar answered Sep 21 '22 14:09

Jiri Patera


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
like image 25
Justin Ludwig Avatar answered Sep 18 '22 14:09

Justin Ludwig