'config log4j via slf4j

we have a standalone java project using log4j for logging,and we don't config log4j via the classpath configuration. we config it in my code as bellow:

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

but if we move to slf4j,how can I config log4j via slf4j?

THKS



Solution 1:[1]

You can't use slf4j for that, you just keep your old configuration code for log4j.

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

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ingo Kegel