freish
freish

Reputation: 33

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

Upvotes: 3

Views: 1665

Answers (1)

Ingo Kegel
Ingo Kegel

Reputation: 47965

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.

Upvotes: 2

Related Questions