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, 3821🔥, 0💬
Popular Posts:
Apache BCEL Source Code Files are inside the Apache BCEL source package file like bcel-6.5.0-src.zip...
What is ojdbc.jar - JDBC Driver for Oracle? ojdbc.jar is a JDBC driver from Oracle that provides dat...
How to perform XML Schema validation with sax\Writer.java provided in the Apache Xerces package? You...
What Is fop.jar? I got it from the fop-2.7-bin.zip. fop.jar in fop-2.7-bin.zip is the JAR file for F...
iText is an ideal library for developers looking to enhance web- and other applications with dynamic...