You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Clément Guillaume <cg...@hotpads.com> on 2017/05/02 00:55:53 UTC

Programmatically configure jul to route to log4j2

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

Re: Programmatically configure jul to route to log4j2

Posted by Matt Sicker <bo...@gmail.com>.
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 <cg...@hotpads.com> 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 <bo...@gmail.com>