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

assembly.conf.logback-access.xml Maven / Gradle / Ivy

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

    Tomcat-Slf4j-Logback (https://github.com/tomcat-slf4j-logback/tomcat-slf4j-logback-config/)

    Copyright (c) 2010-2024 Tomcat-Slf4j-Logback.

    All rights reserved. This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available
    at https://www.eclipse.org/legal/epl-v10.html.

    Contributors: Tomcat-Slf4j-Logback Team.

-->
<configuration>

    <property name="max.retention.days" value="60" />

    <!-- always good activate OnConsoleStatusListener -->
    <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> 

    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <!-- For logback-access 1.x -->
        <encoder class="ch.qos.logback.access.PatternLayoutEncoder">
            <pattern>common</pattern>
        </encoder>
        <!-- For logback-access 2.x -->
        <encoder class="ch.qos.logback.access.common.PatternLayoutEncoder">
            <pattern>common</pattern>
        </encoder>
    </appender>

    <!-- Alternative using logstash
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="net.logstash.logback.encoder.LogstashAccessEncoder" />
    </appender>
    -->

    <appender name="ACCESS-LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${catalina.base}/logs/localhost-access.log</file>
        <append>true</append>
        <!-- For logback-access 1.x -->
        <encoder class="ch.qos.logback.access.PatternLayoutEncoder">
            <charset>utf-8</charset>
            <pattern>common</pattern>
        </encoder>
        <!-- For logback-access 2.x -->
        <encoder class="ch.qos.logback.access.common.PatternLayoutEncoder">
            <charset>utf-8</charset>
            <pattern>common</pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>${catalina.base}/logs/archive/localhost-access-%d{yyyyMMdd}-%i.log.tar.gz</fileNamePattern> 
            <maxHistory>${max.retention.days}</maxHistory>
            <maxFileSize>20MB</maxFileSize>
        </rollingPolicy>
    </appender>

    <!-- Alternative using logstash
    <appender name="ACCESS-LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${catalina.base}/logs/localhost-access.log</file>
        <append>true</append>
        <encoder class="net.logstash.logback.encoder.LogstashAccessEncoder" />
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>${catalina.base}/logs/archive/localhost-access-%d{yyyyMMdd}-%i.log.tar.gz</fileNamePattern> 
            <maxHistory>${max.retention.days}</maxHistory>
            <maxFileSize>20MB</maxFileSize>
        </rollingPolicy>
    </appender>
    -->

    <appender-ref ref="ACCESS-LOG" />

</configuration>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy