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

a-core-service.2.0.0.source-code.logback-spring-json.xml Maven / Gradle / Ivy

<configuration>

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

    <springProperty scope="context" name="application_name" source="spring.application.name"/>
    <springProperty name="appName" source="spring.application.name" defaultValue="spring"/>
    <springProperty name="loggingLevel" source="logging.level.app" defaultValue="INFO"/>
    <springProperty name="rootLoggingLevel" source="logging.level.root" defaultValue="WARN"/>
    <springProperty name="loggingFile" source="logging.file.name" defaultValue="service.log"/>

    <appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
        </encoder>
    </appender>

    <appender name="RollingFile"
              class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${loggingFile}</file>
        <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
            <providers>
                <timestamp>
                    <timeZone>UTC</timeZone>
                </timestamp>
                <version/>
                <logLevel/>
                <message/>
                <loggerName/>
                <context/>
                <mdc/>
                <stackTrace/>
            </providers>
        </encoder>
        <rollingPolicy
            class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- rollover daily and when the file reaches 10 MegaBytes -->
            <fileNamePattern>${loggingFile}-%d{yyyy-MM-dd}.%i</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy
                class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>10MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>
    </appender>

    <appender name="AsyncConsole"
              class="ch.qos.logback.classic.AsyncAppender">
        <discardingThreshold>0</discardingThreshold> <!-- default 20, means drop lower event when has 20% capacity remaining -->
        <appender-ref ref="Console" />
        <queueSize>1</queueSize> <!-- default 256 -->
        <includeCallerData>false</includeCallerData><!-- default false -->
        <neverBlock>true</neverBlock><!-- default false, set to true to cause the
            Appender not block the application and just drop the messages -->
    </appender>

    <appender name="AsynRollingFile"
              class="ch.qos.logback.classic.AsyncAppender">
        <discardingThreshold>0</discardingThreshold> <!-- default 20, means drop lower event when has 20% capacity remaining -->
        <appender-ref ref="RollingFile" />
        <queueSize>1</queueSize> <!-- default 256 -->
        <includeCallerData>false</includeCallerData><!-- default false -->
        <neverBlock>false</neverBlock><!-- default false, set to true to cause
            the Appender not block the application and just drop the messages -->
    </appender>

    <root level="${rootLoggingLevel}">
        <appender-ref ref="AsynRollingFile"/>
        <appender-ref ref="AsyncConsole"/>
    </root>

</configuration>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy