All Downloads are FREE. Search and download functionalities are using the official Maven repository.

afkistry.kafkistry-common.0.9.0.source-code.logback.xml Maven / Gradle / Ivy

The newest version!
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">

    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>

    <if condition='property("logging.targets").contains("file") || property("LOGGING_TARGETS").contains("file")'>
        <then>
            <appender name="fileout" class="ch.qos.logback.core.rolling.RollingFileAppender">
                <!--See also http://logback.qos.ch/manual/appenders.html#RollingFileAppender -->
                <file>${SERVICE_LOG_ROOT}/output.log</file>
                <encoder>
                    <pattern>%d{dd.MM.yyyy HH:mm:ss.SSS} %p %t %c [%X] - %m%n</pattern>
                </encoder>
                <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
                    <level>INFO</level>
                </filter>
                <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
                    <maxIndex>10</maxIndex>
                    <FileNamePattern>${SERVICE_LOG_ROOT}/output.log.%i</FileNamePattern>
                </rollingPolicy>
                <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
                    <MaxFileSize>6000KB</MaxFileSize>
                </triggeringPolicy>
            </appender>

            <appender name="fileerr" class="ch.qos.logback.core.rolling.RollingFileAppender">
                <!--See also http://logback.qos.ch/manual/appenders.html#RollingFileAppender -->
                <file>${SERVICE_LOG_ROOT}/error.log</file>
                <encoder>
                    <pattern>%d{dd.MM.yyyy HH:mm:ss.SSS} %p %t %c [%X] - %m%n</pattern>
                </encoder>
                <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
                    <level>ERROR</level>
                </filter>
                <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
                    <maxIndex>10</maxIndex>
                    <FileNamePattern>${SERVICE_LOG_ROOT}/error.log.%i</FileNamePattern>
                </rollingPolicy>
                <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
                    <MaxFileSize>6000KB</MaxFileSize>
                </triggeringPolicy>
            </appender>

            <root>
                <appender-ref ref="fileout"/>
                <appender-ref ref="fileerr"/>
            </root>
        </then>
    </if>

    <if condition='isDefined("LOGSTASH_HOST") &amp;&amp; (property("logging.targets").contains("logstash") || property("LOGGING_TARGETS").contains("logstash"))'>
        <then>
            <appender name="LOGSTASH" class="de.siegmar.logbackgelf.GelfUdpAppender">
                <graylogHost>${LOGSTASH_HOST}</graylogHost>
                <encoder class="de.siegmar.logbackgelf.GelfEncoder">
                    <includeMdcData>true</includeMdcData>
                    <includeMarker>true</includeMarker>
                    <includeLevelName>true</includeLevelName>
                    <numbersAsString>false</numbersAsString>
                    <shortPatternLayout class="ch.qos.logback.classic.PatternLayout">
                        <pattern>%m%nopex</pattern>
                    </shortPatternLayout>
                    <fullPatternLayout class="ch.qos.logback.classic.PatternLayout">
                        <pattern>%m%n</pattern>
                    </fullPatternLayout>
                    <staticField>facility:${LOGSTASH_FACILITY:-kafkistry}</staticField>
                </encoder>
                <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
                    <level>${LOGSTASH_LEVEL:-DEBUG}</level>
                </filter>
            </appender>

            <appender name="ASYNC_LOGSTASH" class="ch.qos.logback.classic.AsyncAppender">
                <neverBlock>true</neverBlock>
                <appender-ref ref="LOGSTASH"/>
            </appender>

            <root>
                <appender-ref ref="ASYNC_LOGSTASH"/>
            </root>
        </then>
    </if>


    <!-- DEFAULT section when running locally and/or on debugger -->
    <if condition='property("logging.targets").contains("console") || property("LOGGING_TARGETS").contains("console") || (!isDefined("LOGGING_TARGETS") &amp;&amp; !isDefined("logging.targets"))'>
        <then>
            <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
                <encoder>
                    <pattern>[%d{yyyy-MM-dd_HH:mm:ss.SSS}] [%thread] %highlight(%-5level) %cyan(%logger{15}) [%X] - %msg %n</pattern>
                </encoder>
            </appender>

            <root>
                <appender-ref ref="CONSOLE"/>
            </root>
        </then>
    </if>

    <logger name="com.infobip.kafkistry" level="DEBUG" additivity="true"/>

    <!-- default root level INFO -->
    <root level="INFO" />

    <turboFilter class="ch.qos.logback.classic.turbo.DynamicThresholdFilter">
        <Key>X-Log-Level</Key>
        <DefaultThreshold>${LOG_LEVEL:-TRACE}</DefaultThreshold>
        <MDCValueLevelPair>
            <value>ERROR</value>
            <level>ERROR</level>
        </MDCValueLevelPair>
        <MDCValueLevelPair>
            <value>WARN</value>
            <level>WARN</level>
        </MDCValueLevelPair>
        <MDCValueLevelPair>
            <value>DEBUG</value>
            <level>DEBUG</level>
        </MDCValueLevelPair>
    </turboFilter>

</configuration>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy