import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
public class MyApplication {
private static final Logger logger = Logger.getLogger(MyApplication.class);
public static void main(String[] args) {
PropertyConfigurator.configure("log4j.properties");
logger.debug("Debug message");
logger.info("Info message");
logger.warn("Warning message");
logger.error("Error message");
}
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MyApplication {
private static final Logger logger = LoggerFactory.getLogger(MyApplication.class);
public static void main(String[] args) {
logger.debug("Debug message");
logger.info("Info message");
logger.warn("Warning message");
logger.error("Error message");
}
}
import java.util.logging.Logger;
public class MyApplication {
private static final Logger logger = Logger.getLogger(MyApplication.class.getName());
public static void main(String[] args) {
logger.finest("Finest message");
logger.fine("Fine message");
logger.info("Info message");
logger.warning("Warning message");
logger.severe("Severe message");
}
}