codefx
codefx

Reputation: 10502

How to set jenkins log level from maven?

I am running Jenkins from source using mvn jenkins-dev:run. It seems to be logging at the DEBUG level making page load very slow. How do I change the log level of Jenkins. I have tried the usual util.logging properties file, but I can't get it working.

Upvotes: 2

Views: 4220

Answers (1)

Nicolae
Nicolae

Reputation: 451

mvn jenkins-dev:run -Dorg.slf4j.simpleLogger.defaultLogLevel=error

Default log level for all instances of SimpleLogger. Must be one of ("trace", "debug", "info", "warn", or "error"). If not specified, defaults to "info".

You can also edit ${MAVEN_HOME}/conf/logging/simplelogger.properties to make it consistent.

More info here: http://maven.apache.org/maven-logging.html

EDIT:

To also control the log level of the Jenkins war itself as the OP wanted i was able to do so using:

mvn jenkins-dev:run -Djava.util.logging.config.file=my-logging.properties

The contents of my-logging.properties are:

handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
.level= SEVERE

Now i only see two INFO messages comming from jetty . One could also configure the jetty logger via the same file if needed, i will not go into more detail about how to do this because i have little experience with it, but if i could take a guess, you would have to manipulate the correct class (eg: org.eclipse.jetty.LEVEL=WARN) used by Jenkins when embedding jetty.

Upvotes: 3

Related Questions