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:
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, 3399🔥, 0💬
Popular Posts:
What Is commons-logging-1.2.jar? commons-logging-1.2.jar is the JAR file for Apache Commons Logging ...
JRE 8 plugin.jar is the JAR file for JRE 8 Java Control Panel Plugin interface and tools. JRE (Java ...
How to run "jar" command from JDK tools.jar file? "jar" is the JAR (Java Archive) file management co...
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....
JDK 11 jdk.rmic.jmod is the JMOD file for JDK 11 RMI (Remote Method Invocation) Compiler Tool tool, ...