Microsoft
Software
Hardware
Network
Question : Use slf4j with properties file
Hi,
I'm trying to log with slf4j using properties file. But I am not sure how to load the properties file. Here is the code I'm using:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TestLog4j {
public static void main(String[] args) {
Logger logger = LoggerFactory.getLogger(Te
stLog4j.cl
ass);
// This works only for log4j, but not slf4j
//PropertyConfigurator.con
figure("lo
g4j.proper
ties");
logger.info("Hello World");
}
private TestLog4j() {
}
}
My log4j.properties file looks like this:
log4j.appender.A1=org.apac
he.log4j.R
ollingFile
Appender
log4j.appender.A1.File=inf
o.log
log4j.appender.A1.layout=o
rg.apache.
log4j.Patt
ernLayout
log4j.logger.TestLog4j=INF
O, A1
Thanks a lot!
Answer : Use slf4j with properties file
You should have to load it at all explicitly. Just make sure it's in the classpath
Random Solutions
Visual FoxPro OLE DB Data Provider Problems
What is the best layer 7 filtering firewall?
set facebook image for link
Is window visible, in front
Error: "DataTable already belongs to another DataSet."
dcpromo Setup Wizard and AD replication
How to get form variables in checkboxes, radio buttons, and select dropdown menus to pass back to a form, when I edit a userID.
Cannot print any PDF document, only option is to save as .prn and then it does not print.
Dell Powerconnect switch 3524/48P PC/IP phones daisy chaining Vlan setup
Group policy issues - SBS 2003 to windows 2008 R2 migration