Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Hello Program with Apache Log4j
How to write a simple Hello program with Apache Log4j? I need it to test out which JARs are needed to compile and run my Java applications using Apache Log4j.
✍: FYIcenter.com
Below is a simple Hello program, HelloLog4j2.java, that calls the Log4j 2 API:
// Copyright (c) FYIcenter.com
import org.apache.logging.log4j.*;
public class HelloLog4j2 {
private static final Logger logger = LogManager.getLogger("fyiLogger");
public static void main(String[] args) {
System.out.println("Logger class: "+logger.getClass().getName());
logger.fatal("Hello - fatal");
logger.error("Hello - error");
logger.warn("Hello - warn");
logger.info("Hello - info");
logger.debug("Hello - debug");
logger.trace("Hello - trace");
}
}
This sample program, HelloLog4j2.java, does the following:
⇒ Compiling Program with Apache Log4j
⇐ Including Apache Log4j JAR Files in Classpath
2015-11-18, ∼2946🔥, 0💬
Popular Posts:
JDK 11 java.sql.jmod is the JMOD file for JDK 11 SQL (Structured Query Language) module. JDK 11 SQL ...
What is the sax\Writer.java provided in the Apache Xerces package? I have Apache Xerces 2.11.0 insta...
JDK 17 jdk.charsets.jmod is the JMOD file for JDK 17 Charsets module. JDK 17 Charsets module compile...
What Is mail.jar of JavaMail 1.4? I got the JAR file from javamail-1_4.zip. mail.jar in javamail-1_4...
How to run "jarsigner" command from JDK tools.jar file? "jarsigner" command allows you to digitally ...