Log4JLogger Logger and log4j.properties File
How to use Log4JLogger Logger and log4j.properties File?
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
2016-11-16, 1020👍, 0💬
The SOAP with Attachments API for JavaTM (SAAJ) 1.3 provides the API for creating and sending SOAP m...
Apache Axis2 is the core engine for Web services. It is a complete re-design and re-write of the wid...
What Is jms.jar? I heard it's related to JMS (Java Message Service) 1.1? The if you have an jms.jar ...
Commons VFS provides a single API for accessing various different file systems. It presents a unifor...
The JSR 105 XML Digital Signature 1.0.1 FCS implementation provides an API and implementation that a...