Disable debug logging log4j2

How can I disable the debug logging that log4j2 spits out when it initializes?

Such things:

2014-10-22 11:16: 45.505 DEBUG Building Plugin [name = filter, class = org.apache.logging.log4j.core.filter.ThresholdFilter]. Looking for the builder factory method ... 2014-10-22 11:16: 45,505 DEBUG The builder factory method was found in the org.apache.logging.log4j.core.filter.ThresholdFilter class. Try to find a factory method. 2014-10-22 11:16: 45,505 DEBUG Plugin for building more [name = filter, class = org.apache.logging.log4j.core.filter.ThresholdFilter]. Finding a factory method ...

I am calling log4j2 from a simple Java application via eclipse. By this I mean: public static void main (String [] args) {...}

Part of xml configuration loggers:

 <Loggers>
    <Root level="trace"/>

    <logger name="audit">
        <appender-ref ref="AUDITOUT"/>
        <appender-ref ref="DEBUGOUT"/>

        <appender-ref ref="ORACLEOUTINFO"/>
        <appender-ref ref="ORACLEOUTWARN"/>
        <appender-ref ref="ORACLEOUTERROR"/>
        <appender-ref ref="ORACLEOUTFATAL"/>
    </logger>

    <logger name="org.apache.log4j">
        <appender-ref ref="FILEOUT"/>
        <appender-ref ref="STDOUT"/>

        <appender-ref ref="ORACLEOUTWARN"/>
        <appender-ref ref="ORACLEOUTERROR"/>
        <appender-ref ref="ORACLEOUTFATAL"/>
    </logger>

    <logger name="jh.Runner2">
        <appender-ref ref="DEBUGOUT"/>
        <appender-ref ref="STDOUT"/>

        <appender-ref ref="ORACLEOUTTRACE"/>
        <appender-ref ref="ORACLEOUTDEBUG"/>
        <appender-ref ref="ORACLEOUTINFO"/>
        <appender-ref ref="ORACLEOUTWARN"/>
        <appender-ref ref="ORACLEOUTERROR"/>
        <appender-ref ref="ORACLEOUTFATAL"/>
    </logger>
 </Loggers>

      

Appenders:

 <Appenders>
    <Console name="STDOUT">
        <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/>
        <PatternLayout pattern="%d %p [%t] - %m%n"/>
    </Console>

    <RollingFile name="FILEOUT" fileName="${log-path}/mainlog2.log" filePattern="${log-path}/mainlog-%d{yyyy-MM-dd}.log">
        <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
        <PatternLayout pattern="%d %p [%t] - %m%n"/>
        <Policies>
            <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
        </Policies>
    </RollingFile>

    <RollingFile name="DEBUGOUT" fileName="${log-path}/debuglog2.log" filePattern="${log-path}/debuglog-%d{yyyy-MM-dd}.log">
        <ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/>
        <PatternLayout pattern="%d %p %C [%t] - %m%n"/>
        <Policies>
            <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
        </Policies>
    </RollingFile>

    <RollingFile name="AUDITOUT" fileName="${log-path}/audit2.log" filePattern="${log-path}/auditlog-%d{yyyy-MM-dd}.log">
        <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
        <PatternLayout pattern="%d %p [%t] - %m%n"/>
        <Policies>
            <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
        </Policies>
    </RollingFile>

    <JDBC name="ORACLEOUTTRACE" tableName="J0T_EVENT">
        <Filters>
            <ThresholdFilter level="DEBUG" onMatch="DENY" onMismatch="NEUTRAL"/>
            <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/>
        </Filters>
        <ConnectionFactory class="com.xxxxxxxxx.db.LoggingDBConnectionFactory" method="getDatabaseConnection" />
        <Column name="EVENT_ID" literal="${nextEventID}"/>
        <Column name="APP_NM" literal="${appName}"/>
        <Column name="CREATE_DT" isEventTimestamp="true"/>
        <Column name="EVENT_TYPE_ID" literal="1"/>
        <Column name="EVENT_TXT" pattern="${eventTxtPattern}" isUnicode="false"/>
    </JDBC>

      

and etc.

+3


source to share


1 answer


Your config starts with

<Configuration status="debug" ...

      

Change this to



<Configuration status="warn" ...

      

and you will only see the internal log4j WARN messages (which is probably what you want).

+14


source







All Articles