Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Logging Custom Handlers JUL

Joakim, thank you kindly for this.

I will let you know how i get on.

Joakim Erdfelt wrote:
The ./lib/ext folder is also too late in the process to include the custom java.util.logging handlers.

You have a choice at this point.

1) Do not use LogManager.readConfiguration() but rather use the Logger.addHandler() technique instead.
     This means you cannot use the default logging.properties facilities.
     This is due to the fact that by the time java.util.logging is initialized (one of the first thing the JVM does on startup) you don't have jetty yet started to even manage the classpath/classloaders.
      That means the ClassLoader that initialized the LogManager has no access to your custom handlers.

      I created an example project showing how to set this up, see https://github.com/jetty-project/jetty-and-jul-example.
      (I need to blog about this)

2) Do not rely on default jetty's start.jar and write your own jetty bootstrapping that includes the custom logging handler in the startup classpath and then use the jetty-xml.jar to configure your jetty instance.

     There might be a configuration option around the --exec startup command (but I haven't researched that angle yet)


Back to the top