Log4j2 and log4j differ on the configuration file and the introduction jar package, here is a memo, the version used here is Apache-log4j-2.3-bin.zip.
1, Apache-log4j-2.3-bin.zip Download:
Official website or: http://download.csdn.net/download/tterminator/9005991
2, need to introduce the JAR package
In addition to the presence of SLF4J in the jar package name, all other needs to be introduced.
3,log4j2 configuration file (official website log4j only support XML and JSON-formatted configuration files, no longer support log4j-properties type of key-value pair configuration file, which is the most distinguished from log4j), the configuration file name is called Log4j2.xml, the contents are as follows:
<?xml version= "1.0" encoding= "UTF-8"?> <configuration status= "error" > <appenders> <console name= "Console" target= "System_out" > <thresholdfilter level= "Debug" onmatch= "ACCEPT" Onmismatch= "DENY"/> <patternlayout pattern= "%d{hh:mm:ss. SSS}%-5level%class{36}%l%M-%msg%xex%n "/> </Console> <file name=" log "filename=" Weiyj.log " Append= "true" > <patternlayout pattern= "%d{hh:mm:ss. SSS}%-5level%class{36}%l%M-%msg%xex%n "/> </File> </appenders> <loggers> <root level= "Trace" > <appender-ref ref= "log"/> <appender-ref ref= "Console"/> </root> </loggers>
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Eclipse Integration log4j2-2.3