Skip to content
Advertisement

How do I configure log4j to send log events to java.util.logging using JULAppender?

I am familiar with the java.util.logging (JUL) framework, I use it extensively. Recently, I started using a library that does its logging through log4j. When I start my application I now get the following printed on the console:

JavaScript

It appears that log4j has a solution for this: JULAppender which will send everything logged with log4j to the logging framework that I use.

I can’t find any examples that show me how to configure log4j to use this appender.

Advertisement

Answer

The standard way of configuring log4j is to create log4j.xml in the root of the classpath. Here are contents of that file configured for JULAppender:

JavaScript
Advertisement