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

.http-sidecar.2.1.30.source-code.logback.xml Maven / Gradle / Ivy

There is a newer version: 2.1.37
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2016 Network New Technologies Inc.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<configuration>
    <!-- TODO create logger for audit only.
    http://stackoverflow.com/questions/2488558/logback-to-log-different-messages-to-two-files -->
    <turboFilter class="ch.qos.logback.classic.turbo.MarkerFilter">
        <Marker>PROFILER</Marker>
        <!--<OnMatch>DENY</OnMatch>-->
        <OnMatch>NEUTRAL</OnMatch>
    </turboFilter>

    <!--stdout log-->
    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
        <!-- encoders are assigned the type
             ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
        <encoder>
            <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSS} [%thread] %X{sId} %X{cId} %-5level %class{36}:%L %M - %msg%n</pattern>
        </encoder>
    </appender>

    <!--stdout-file log-->
    <appender name="stdout-file" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>log/stdout.log.json</file>
        <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
            <providers>
                <timestamp>
                    <fieldName>timestamp</fieldName>
                    <pattern>yyyy-MM-dd'T'HH:mm:ss.SSSZ</pattern>
                </timestamp>
                <pattern>
                    <pattern>
                        {
                            "thread": "%thread",
                            "level": "%-5level",
                            "logger": "%logger{64}",
                            "correlationId": "%X{cId}",
                            "serviceId": "%X{sId}",
                            "class": "%F",
                            "lineNumber": "%class{64}:%L",
                            "method": "%M",
                            "logMessage": "#tryJson{%message}"
                        }
                    </pattern>
                </pattern>
                <rootStackTraceElement/>
                <stackTrace/>
            </providers>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <fileNamePattern>log/stdout.log.json.%i.zip</fileNamePattern>
            <minIndex>1</minIndex>
            <maxIndex>5</maxIndex> <!-- max number of archived logs that are kept -->
        </rollingPolicy>
        <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <maxFileSize>200MB
            </maxFileSize> <!-- The size of the logfile that triggers a switch to a new logfile, and the current one archived -->
        </triggeringPolicy>
    </appender>

    <!-- audit log-->
    <appender name="audit" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>log/audit.json</file> <!-- logfile location -->
        <encoder>
            <pattern>%date{ISO8601} %msg%n</pattern> <!-- the layout pattern used to format log entries -->
            <immediateFlush>true</immediateFlush>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <fileNamePattern>log/audit.json.%i.zip</fileNamePattern>
            <minIndex>1</minIndex>
            <maxIndex>5</maxIndex> <!-- max number of archived logs that are kept -->
        </rollingPolicy>
        <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <maxFileSize>200MB
            </maxFileSize> <!-- The size of the logfile that triggers a switch to a new logfile, and the current one archived -->
        </triggeringPolicy>
    </appender>


    <root level="error">
        <appender-ref ref="stdout"/>
        <appender-ref ref="stdout-file"/>
    </root>

    <logger name="com.networknt" level="debug" additivity="false">
        <appender-ref ref="stdout"/>
        <appender-ref ref="stdout-file"/>
    </logger>

    <logger name="Audit" level="info" additivity="false">
        <appender-ref ref="audit"/>
    </logger>

</configuration>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy