Enabling debug logging with embedded Jetty

1,300 views
Skip to first unread message

Elijah Zupancic

unread,
Feb 18, 2016, 10:46:51 PM2/18/16
to Jenkins Developers
I'm attempting to solve a problem where Jenkins locks up when serving HTTPS traffic in an system that is emulating the Linux kernel (https://wiki.smartos.org/display/DOC/LX+Branded+Zones). I've isolated the problem to the embedded Jetty inside the patched winstone abstraction (https://github.com/jenkinsci/winstone). For the purposes of my debugging exercise, I'm using version 2.9 of the patched winstone library.

Now, I'm trying to get that embedded version of Jetty to output debug logs. Try as I might by passing all of the default jetty system properties for logging, I can't get the thing out of the JUL logging mode nor can I get JUL to log in debug mode. Does anyone have a recipe for enabling debug/trace logging in embedded jetty?

I have tried the following system properties in nearly every configuration:
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
org.eclipse.jetty.LEVEL=DEBUG
java.util.logging.config.file=/root/winstone-test/logging.properties 
org.eclipse.jetty.util.log.DEBUG=true

Contents of /root/winstone-test/logging.properties 
handlers = java.util.logging.ConsoleHandler
.level = ALL

When I hook up a debugger to the instance, I still see that the LOG instances are always being assigned to JavaUtilLog and never to StdErrLog. I noticed that when I set org.eclipse.jetty.util.log.DEBUG=true, it at least forwards the log calls to JUL logging. However, it never gets output to the consul. Does the Winstone wrapper around embedded Jetty override all of the system properties? 

How do I get debug logs from the embedded Jetty server?

Thanks,
Elijah Zupancic

Elijah Zupancic

unread,
Feb 19, 2016, 1:34:30 PM2/19/16
to Jenkins Developers
I've figured this out myself. I'll leave the answer here for posterity. In your Java util logging configuration, you need to specify the logging level for the console logger explicitly. This is my working configuration:

handlers = java.util.logging.ConsoleHandler
.level = ALL
java.util.logging.ConsoleHandler.level = ALL
Reply all
Reply to author
Forward
0 new messages