Adam Loh
Adam Loh

Reputation: 115

Remove red coloured logs from console

How do I remove the red logs in the console?

I have a Java Spring Boot project that has log4j and slf4j dependencies using Maven. I am developing on IntelliJ. I keep receiving red logs in my console which I want to remove/hide:

Console logs

The issue is each time I receive an MQTT message from Camel, a message appears:

MQTT Message Log

I have a src/main/resources/log4j2.xml file with the following configuration:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" monitorInterval="30">
    <Properties>
        <Property name="LOG_PATTERN">
            %d{yyyy-MM-dd HH:mm:ss.SSS zzz} [%-40.40c] --> %m%n%ex
        </Property>
        <Property name="baseDir">logs</Property>
    </Properties>
    <Appenders>
        <Console name="ConsoleAppender" target="SYSTEM_OUT" follow="true">
            <PatternLayout pattern="${LOG_PATTERN}"/>
        </Console>
        <!-- filePattern determines the granularity -->
        <RollingFile
                name="RollingFile"
                fileName="${baseDir}/info.log"
        >
            <PatternLayout>
                <Pattern>"${LOG_PATTERN}"</Pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
                <SizeBasedTriggeringPolicy size="5MB"/>
            </Policies>
            <DefaultRolloverStrategy max="50">
                <Delete basePath="${baseDir}" maxDepth="3">
                    <IfFileName glob="*/*/*.log">
                        <IfLastModified age="P90D"/>
                    </IfFileName>
                </Delete>
            </DefaultRolloverStrategy>
        </RollingFile>

    </Appenders>

    <Loggers>
        <Root level="OFF">
            <AppenderRef ref="ConsoleAppender" />
        </Root>
    </Loggers>
</Configuration>

Upvotes: -2

Views: 64

Answers (0)

Related Questions