Programmatically configure jul to route to log4j2

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Programmatically configure jul to route to log4j2

Clément Guillaume
Hi,

I wonder if it would be possible to programmatically configure jul to route
to log4j2.
It would be useful in case where system properties can not be used to set
the LogManager or the log4j-jul jar cannot be in the classpath at bootstrap.

jul to log4j2 bridge allow a similar configuration:
https://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Programmatically configure jul to route to log4j2

Matt Sicker
You can set the system property in your main() method as the first line
which would do the trick.

As for a way to register itself later, I suppose that would be a feature
request: https://issues.apache.org/jira/browse/LOG4J2

On 1 May 2017 at 19:55, Clément Guillaume <[hidden email]> wrote:

> Hi,
>
> I wonder if it would be possible to programmatically configure jul to route
> to log4j2.
> It would be useful in case where system properties can not be used to set
> the LogManager or the log4j-jul jar cannot be in the classpath at
> bootstrap.
>
> jul to log4j2 bridge allow a similar configuration:
> https://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html
>



--
Matt Sicker <[hidden email]>
Loading...