I have an app that initializes a logger like this:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Main {
private static Logger logger = LoggerFactory.getLogger(Main.class);
public static void main(String[] args) {
logger.info("Logging something");
}
}
I want it to read logging config from the log4j.properties
file. I have found that I can make an explicit call to org.apache.log4j.PropertyConfigurator
to accomplish that, but I was told the app should be able to find the properties file automatically.
Is there a way run the app so that SLF4J automatically configures log4j from the properties file?