Log4j2 로그 등급별(error 단독 출력)

12315 단어 프로젝트 일상

<configuration status="info" name="defaultLogConfig">
    <properties>
        <property name="LOG_HOME">d:/logsproperty>
        <property name="PATTERN_LAYOUT">%d [%7r] %6p - %30.30c - %m 
property> properties> <Appenders> <Console name="Console" target="SYSTEM_OUT" follow="true"> <PatternLayout pattern="${PATTERN_LAYOUT}" charset="GBK"/> Console> <RollingFile name="INFO" fileName="${LOG_HOME}/info.log" filePattern="${LOG_HOME}/info-%d{yyyyMMdd}-%i.log.gz"> <PatternLayout pattern="${PATTERN_LAYOUT}"/> <Filters> <ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/> <ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/> Filters> <Policies> <TimeBasedTriggeringPolicy /> <SizeBasedTriggeringPolicy size="500MB"/> Policies> <DefaultRolloverStrategy max="10"/> RollingFile> <RollingFile name="ERROR" fileName="${LOG_HOME}/error.log" filePattern="${LOG_HOME}/error-%d{yyyyMMdd}-%i.log.gz"> <PatternLayout pattern="${PATTERN_LAYOUT}"/> <Filters> <ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/> Filters> <Policies> <TimeBasedTriggeringPolicy /> <SizeBasedTriggeringPolicy size="500MB"/> Policies> <DefaultRolloverStrategy max="10"/> RollingFile> Appenders> <Loggers> <AsyncLogger name="org.springframework.beans" level="error"> <AppenderRef ref="Console" /> <AppenderRef ref="INFO" /> <AppenderRef ref="ERROR" /> AsyncLogger> <AsyncLogger name="org.springframework.core" level="error"> <AppenderRef ref="Console" /> <AppenderRef ref="INFO" /> <AppenderRef ref="ERROR" /> AsyncLogger> <AsyncLogger name="org.springframework.context" level="error"> <AppenderRef ref="Console" /> <AppenderRef ref="INFO" /> <AppenderRef ref="ERROR" /> AsyncLogger> <AsyncLogger name="org.springframework.web" level="error"> <AppenderRef ref="Console" /> <AppenderRef ref="INFO" /> <AppenderRef ref="ERROR" /> AsyncLogger> <AsyncLogger name="com.mybatis" level="error"> <AppenderRef ref="Console" /> <AppenderRef ref="INFO" /> <AppenderRef ref="ERROR" /> AsyncLogger> <Root level="${log4j.level}"> <AppenderRef ref="Console" /> <AppenderRef ref="INFO" /> <AppenderRef ref="ERROR" /> Root> Loggers> configuration>

좋은 웹페이지 즐겨찾기