File name Log4j2.xml:
<?xml version= "1.0" encoding= "UTF-8"? ><configuration status= "INFO" ><properties ><property name= "Log_home" >h://logs//web</Property></Properties><appenders> <console name= "STDOUT" target= "system_out" ><!--console only outputs level and above information (Onmatch), Other direct rejections (Onmismatch) --><thresholdfilter level= "DEBUG" onmatch= "ACCEPT" onmismatch= " DENY " /><patternlayout pattern="%d{hh:mm:ss. sss} [%t] %-5level - %msg - [%logger{36}:%m:%l] %n " /></Console ><!-- Main log file --><rollingfile name= "Rofile" filename= "${log_home}/mainserver.log "Filepattern=" ><PatternLayout "${log_home}/$${date:yyyy-mm-dd}/mainserver-%d{yyyy-mm-dd}-%i.log" Pattern= "%d{yyyy. Mm.dd hh:mm:ss. sss} [%t] %-5level - %msg - [%logger{36}:%m:%l] %n " /><Policies ><timebasedtriggeringpolicy /><siZebasedtriggeringpolicy size= "250&NBSP;MB" /></Policies><!-- maximum 10 files reserved --> <defaultrolloverstrategy max= "Ten" /></RollingFile></appenders><loggers>< Logger name= "Org.springframework" level= "INFO" additivity= "true" ><appenderref ref= " STDOUT " /></logger><logger name=" Org.apache.ibatis " level=" DEBUG " additivity=" True "><appenderref ref=" STDOUT " /></logger><logger name=" Java.sql.Connection " level= "DEBUG" additivity= "true" ><appenderref ref= "STDOUT" /></Logger>< Logger name= "Java.sql.PreparedStatement" level= "DEBUG" additivity= "true" ><appenderref ref= "STDOUT" /></logger><logger name= "Java.sql.ResultSet" level= "DEBUG" Additivity= "true" ><appenderref ref= "STDOUT" /></logger><root level= "INFO" > <appender-ref ref= "Rofile" /><appender-ref ref= "STDOUT" /></root></loggers></ Configuration>
log4j2.x XML configuration file contents