Skip to content

Use logback-access as web server access log implmenetation for projects

Notifications You must be signed in to change notification settings

wacai/spring-boot-starter-logback-access

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Use logback-access as Web server access log implmenetation for spring-boot-starter-web projects.

使用logback-access作为 spring-boot-starter-web 项目内置 WEB 容器的 Access 日志输出的实现。

Usage

pom.xml

<dependency>
    <groupId>com.wacai</groupId>
    <artifactId>spring-boot-starter-logback-access</artifactId>
    <version>${last-version}</version>
</dependency>

application.properties

logback.access.config.path=classpath:logback-access.xml

logback-access.xml

<configuration>

    <property name="LOG_HOME" value="${LOG_HOME:-${user.dir}/logs}"/>

    <appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <File>${LOG_HOME}/access.log</File>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_HOME}/access-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>100MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>
        <encoder>
            <pattern>%h %l %u %user %date "%r" %s %b</pattern>
        </encoder>
    </appender>

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

About

Use logback-access as web server access log implmenetation for projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages