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:
Log4JLogger Logger and log4j.properties File
How to use Log4JLogger Logger and log4j.properties File?
✍: FYIcenter.com
The suggested way to use the Log4JLogger Logger and log4j.properties File
is to do the following:
1.Create commons-logging.properties file with one entry:
# commons-logging.properties org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
2.Create log4j.properties file:
# log4j.properties # Copyright (c) 2016 FYIcenter.com # Set log level and define my appender log4j.rootLogger=TRACE, MyConsole # Configure my appender log4j.appender.MyConsole=org.apache.log4j.ConsoleAppender log4j.appender.MyConsole.layout=org.apache.log4j.PatternLayout log4j.appender.MyConsole.layout.ConversionPattern=%-4r %-5p [%t] %37c %3x - %m%n
3. Download and install Log4j JAR at C:\local\log4j-1.2.17\log4j-1.2.17.jar. Add Log4j JAR to the JVM class path.
4. Run the HelloCommonsLogging example code with both properties files in the current folder, which is included in the class path:
C:\fyicenter>java -cp .;C:\local\commons-logging-1.2\commons-logging-1.2.jar; C:\local\log4j-1.2.17\log4j-1.2.17.jar HelloCommonsLogging Log class: org.apache.commons.logging.impl.Log4JLogger 0 FATAL [main] MyLogging - Hello - fatal 16 ERROR [main] MyLogging - Hello - error 16 WARN [main] MyLogging - Hello - warn 16 INFO [main] MyLogging - Hello - info 16 DEBUG [main] MyLogging - Hello - debug 16 TRACE [main] MyLogging - Hello - trace
⇒ FAQ for Apache commons-logging.jar
⇐ Jdk14Logger Logger and logging.properties File
2016-11-16, ∼4221🔥, 0💬
Popular Posts:
commons-lang-2.6.jar is the JAR file for Apache Commons Lang 2.6, which provides a host of helper ut...
JDK 11 java.xml.crypto.jmod is the JMOD file for JDK 11 XML (eXtensible Markup Language) Crypto modu...
JDK 11 jdk.javadoc.jmod is the JMOD file for JDK 11 Java Document tool, which can be invoked by the ...
Apache Log4j Core Implementation provides the functional components of the logging system. Users are...
JDK 1.1 source code directory contains Java source code for JDK 1.1 core classes: "C:\fyicenter\jdk-...