java - How to write log to file using slf4j -


I have decided to use slf4j instead of very logging of Java. I'm successfully logging to the console to use slf4j but I do not know how to write it in the log file. The log file will help us to gather potential errors with runtime.

I am implementing Slough 4G by doing this,

private static last org.slf4j.Logger LOGGER = org .slf4j.LoggerFactory.getLogger (Class1.class );

Then I am starting the log4j properties,

PropertyConfigurator.configure (New FileInputStream ("

slf4j

is the only API, you need to add a logger engine (And switching between them is easy). You have to select one (logback for exmaple) and configure the configuration file to be written in the file.

As told on the slf4j site Is:

Law for Simple Java (SLF4J) The Ging Mask acts as a simple mask or abstract for various logging frameworks (such as java.util.logging, logback, log4j), which allows the end user to plug in the desired logging framework at the time of deployment.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -