java - Log4j is not working -
I'm trying with logging methods (Log4j) in Eclipse and I'm having the following problems
< P> And I posted the log4j.properties file in the project folder. Below is one of the main ways of my program: package com.aransys.roughworkout.log4j; Import org.apache.log4j.Logger; Import java.io.IOException; Import java.sql.SQLException; Import java.util.logging. *; Public class Log4jExample {static logger log = logger .getRootLogger (); Public static zero master throws (string [] args) IOException, SQLException {log.debug ("sample debug message"); Log.info ("Sample information message"); Logs. Warne ("Sample Warning Message"); Log.error ("sample error message"); Log.fatal ("Sample Hazardous Message"); }}
and below is a code in my program in Log4j.properties:
log4j.rootlogger = debug, FILE log4j.appender.FILE = Org .apache.log4j.ConsoleAppender log4j.appender.FILE.layout = org.apache.log4j.SimpleLayout
But the code is not running properly, and it's stating the following error.
thread "main" java.lang.Error: unresolved compile problem: com.aransys.roughworkout.log4j.Log4jExample.main (Log4jExample.java:8)
Your code is not compiled too! Make your logger in this way:
Private Static Last Logger Log = Logger. Gate Logger (Log4jExample.class);
remove more
import java.util.logging. *;
After that, clean up and build your project.
Comments
Post a Comment