|
@@ -63,14 +63,60 @@
|
|
|
</filter>
|
|
</filter>
|
|
|
</appender>
|
|
</appender>
|
|
|
|
|
|
|
|
|
|
+ <!--为了防止进程退出时,内存中的数据丢失,请加上此选项-->
|
|
|
|
|
+ <shutdownHook class="ch.qos.logback.core.hook.DefaultShutdownHook"/>
|
|
|
|
|
+ <!-- 可用来获取StatusManager中的状态 -->
|
|
|
|
|
+ <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener"/>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 解决debug模式下循环发送的问题 -->
|
|
|
|
|
+ <logger name="org.apache.http.impl.conn.Wire" level="WARN" />
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 引入sls日志 -->
|
|
|
|
|
+ <appender name="aliyun" class="com.aliyun.openservices.log.logback.LoghubAppender">
|
|
|
|
|
+ <!-- Configure account and network -->
|
|
|
|
|
+ <endpoint>cn-shenzhen.log.aliyuncs.com</endpoint>
|
|
|
|
|
+ <!-- 填写sls key密钥 -->
|
|
|
|
|
+ <accessKeyId>**********</accessKeyId>
|
|
|
|
|
+ <accessKeySecret>*****************</accessKeySecret>
|
|
|
|
|
+
|
|
|
|
|
+ <project>tajia-log</project>
|
|
|
|
|
+ <!--logStore名称 -->
|
|
|
|
|
+ <logStore>tajia-api</logStore>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- Optional parameters -->
|
|
|
|
|
+<!-- #单个 producer 实例能缓存的日志大小上限,默认为 100MB。-->
|
|
|
|
|
+ <totalSizeInBytes>104857600</totalSizeInBytes>
|
|
|
|
|
+ <maxBlockMs>0</maxBlockMs>
|
|
|
|
|
+<!-- 执行日志发送任务的线程池大小,默认为可用处理器个数。-->
|
|
|
|
|
+ <ioThreadCount>8</ioThreadCount>
|
|
|
|
|
+ <batchSizeThresholdInBytes>524288</batchSizeThresholdInBytes>
|
|
|
|
|
+ <batchCountThreshold>4096</batchCountThreshold>
|
|
|
|
|
+ <lingerMs>2000</lingerMs>
|
|
|
|
|
+ <retries>10</retries>
|
|
|
|
|
+ <baseRetryBackoffMs>100</baseRetryBackoffMs>
|
|
|
|
|
+ <maxRetryBackoffMs>50000</maxRetryBackoffMs>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 可选项 通过配置 encoder 的 pattern 自定义 log 的格式 -->
|
|
|
|
|
+ <encoder>
|
|
|
|
|
+ <pattern>%d %-5level [%thread] %X{traceId} %logger{0}: %msg</pattern>-->
|
|
|
|
|
+ <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %highlight([%-5level] [%thread] %logger{50} - %msg%n)</pattern>
|
|
|
|
|
+ <charset>UTF-8</charset>
|
|
|
|
|
+ </encoder>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- Optional parameters -->
|
|
|
|
|
+ <timeFormat>yyyy-MM-dd'T'HH:mmZ</timeFormat>
|
|
|
|
|
+ <!-- Optional parameters -->
|
|
|
|
|
+ <timeZone>UTC</timeZone>
|
|
|
|
|
+ <mdcFields>
|
|
|
|
|
+ TraceId,#####
|
|
|
|
|
+ </mdcFields>
|
|
|
|
|
+ </appender>
|
|
|
|
|
|
|
|
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
|
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
|
|
|
|
|
|
|
<springProfile name="dev">
|
|
<springProfile name="dev">
|
|
|
<root level="INFO">
|
|
<root level="INFO">
|
|
|
<appender-ref ref="console"/>
|
|
<appender-ref ref="console"/>
|
|
|
- <appender-ref ref="debug"/>
|
|
|
|
|
- <appender-ref ref="error"/>
|
|
|
|
|
</root>
|
|
</root>
|
|
|
</springProfile>
|
|
</springProfile>
|
|
|
<springProfile name="test">
|
|
<springProfile name="test">
|
|
@@ -85,6 +131,7 @@
|
|
|
<appender-ref ref="console"/>
|
|
<appender-ref ref="console"/>
|
|
|
<appender-ref ref="debug"/>
|
|
<appender-ref ref="debug"/>
|
|
|
<appender-ref ref="error"/>
|
|
<appender-ref ref="error"/>
|
|
|
|
|
+ <appender-ref ref="aliyun" />
|
|
|
</root>
|
|
</root>
|
|
|
</springProfile>
|
|
</springProfile>
|
|
|
</configuration>
|
|
</configuration>
|