• logback配置信息


    <?xml version="1.0" encoding="UTF-8"?>
    
    <configuration scan="true" scanPeriod="5 minutes" >
        <springProperty scope="context" name="logstash" source="logging.logstash"/>
        <springProperty scope="context" name="logpath" source="logging.path"/>
        <contextName>apple</contextName>
        <property name="APP_NAME" value="apple" />
        <property name="ENCODER_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS}|${HOSTNAME}|%level|${APP_NAME}|%class|%thread|%method|%line|%msg%n"/>
    
        <!-- 控制台输出 -->
        <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
            <encoder>
                <pattern>
                    <pattern>${ENCODER_PATTERN}</pattern>
                </pattern>
            </encoder>
        </appender>
    
        <!-- 按照每天生成日志文件 -->
        <appender name="dailyfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>${logpath}/${APP_NAME}.log</file>
            <encoder>
                <charset>UTF-8</charset>
                <pattern>${ENCODER_PATTERN}</pattern>
            </encoder>
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>
                    ${logpath}/${APP_NAME}.log.%d{yyyy-MM-dd}
                </fileNamePattern>
                <maxHistory>30</maxHistory>
            </rollingPolicy>
        </appender>
    
        <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
            <destination>${logstash}</destination>
            <encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
                <customFields>{"appname":"apple"}</customFields>
            </encoder>
            <connectionStrategy>
                <roundRobin>
                    <connectionTTL>5 minutes</connectionTTL>
                </roundRobin>
            </connectionStrategy>
        </appender>
    
        <!-- all,debug,info,warn,error -->
        <root>
            <level value="info" />
            <appender-ref ref="stdout" />
            <appender-ref ref="dailyfile" />
            <appender-ref ref="logstash" />
        </root>
    
        <logger name="com.liying" level="DEBUG" />
        <logger name="org.springframework.web" level="INFO" />
    
    </configuration>

     

  • 相关阅读:
    计算机相关单位换算关系的积累
    谈编程资料
    杂记toCSV
    [转载]Windows 8][Metro Style Apps]淺談Metro Style Apps的瀏覽模式及螢幕解析度
    [转载][Windows 8][Metro Style Apps]Windows 8 開發/執行環境概觀
    【转载】[Windows 8]Hello Windows 8 Windows 8 Developer Preview搶先預覽
    台湾dotnet程序员之家
    [转载]实现Application Tile 更新
    [转载]在.NET中实现OAuth身份认证
    杂记
  • 原文地址:https://www.cnblogs.com/linjiqin/p/10751595.html
Copyright © 2020-2023  润新知