user3641396
user3641396

Reputation: 53

Log4j2 with custom class loader

I'm using an custom ClassLoader to load the needed dependencies from a directory. "log4j-api-2.0-rc1.jar" and "log4j-core-2.0-rc1.jar" are known from my custom URLClassLoader. But as I try to use Log4j2 following error occurs:

ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger

It seems like that the Log4j2 LogManager uses it's own ClassLoader to search for the implementation classes. How can I solve this problem?

Thanks for help!

Upvotes: 1

Views: 1896

Answers (1)

Remko Popma
Remko Popma

Reputation: 36834

By default, log4j will try to load classes using the Thread.currentThread().getContextClassLoader().

If you set system property -Dlog4j.ignoreTCL=true, log4j will load classes using Class.forName(className).

If neither of these solve your problem I would recommend that you raise this on the log4j2 Jira issue tracker to work out a solution together with the team.

Upvotes: 2

Related Questions