Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
Collections:
Other Resources:
Running Program with Apache Log4j Configuration
How to run my program with Apache Log4j configuration files? I have my program using Log4j 2 API compiled. And my log4j2.xml configuration file is ready.
✍: FYIcenter.com
The easiest way to run your program with a Log4j 2 configuration file is:
Here is a run session with the HelloLog4j2.java program and log4j2.xml:
fyicenter> dir . 1584 HelloLog4j2.class 662 log4j2.xml fyicenter> java -cp .:log4j-api-2.14.1.jar:log4j-core-2.14.1.jar \ HelloLog4j2 Logger class: org.apache.logging.log4j.core.Logger 15:54:32.458 [main] FATAL fyiLogger - Hello - fatal 15:54:32.461 [main] ERROR fyiLogger - Hello - error 15:54:32.461 [main] WARN fyiLogger - Hello - warn 15:54:32.461 [main] INFO fyiLogger - Hello - info 15:54:32.461 [main] DEBUG fyiLogger - Hello - debug fyicenter> type HelloLog4j2.log 15:54:32.458 [main] FATAL fyiLogger - Hello - fatal 15:54:32.461 [main] ERROR fyiLogger - Hello - error 15:54:32.461 [main] WARN fyiLogger - Hello - warn 15:54:32.461 [main] INFO fyiLogger - Hello - info 15:54:32.461 [main] DEBUG fyiLogger - Hello - debug
The above session shows that:
⇒ Using Log4j 1.2 Bridge with Log4j 2 API
⇐ Configuration File for Apache Log4j
2015-11-11, 2084🔥, 0💬
Popular Posts:
JDK 11 jdk.internal.vm.ci.jmod is the JMOD file for JDK 11 Internal VM CI module. JDK 11 Internal VM...
What Is jtds-1.2.2.jar? jtds-1.2.2.jar is the JAR files of jTDS Java library 1.2.2, which is a JDBC ...
XOM™ is a new XML object model. It is an open source (LGPL), tree-based API for processing XML with ...
What is the dom\GetElementsByTagName .javaprovided in the Apache Xerces package? I have Apache Xerce...
jlGui is a music player for the Java platform. It is based on Java Sound 1.0 (i.e. JDK 1.3+). It sup...