Config log4j via slf4j

we have a standalone java project using log4j for logging, and we do not configure log4j through classpath configuration. we will configure it in my code below:

String configLocation = System.getProperty("S_HOME") + File.separator + "config" + File.separator + "xxxLog.properties";
PropertyConfigurator.configure(configLocation)

but if we go to slf4j, how can I configure log4j through slf4j?

Thks

+3
source share
1 answer

You cannot use slf4j for this, you just save your old configuration code for log4j.

slf4j does not handle part of the configuration, which would be very difficult to generalize to all supported logging systems. slf4j is just an API for handling calls that are sent to a specific logging implementation. It also offers several bridges, such as redirecting java.util.logging to slf4j.

What happens with log output is not part of the slf4j API.

+2
source

All Articles