All Projects → ofpay → logback-mdc-ttl

ofpay / logback-mdc-ttl

Licence: Apache-2.0 license
logback扩展,集成transmittable-thread-local支持跨线程池的mdc跟踪

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to logback-mdc-ttl

Lilith
Lilith is a Logging- and AccessEvent viewer for Logback, log4j, log4j2 and java.util.logging
Stars: ✭ 111 (+3.74%)
Mutual labels:  logback
Microservices Sample
Sample project to create an application using microservices architecture
Stars: ✭ 167 (+56.07%)
Mutual labels:  logback
springboot-tutorials
codehome出品SpringBoot2.x基础教程
Stars: ✭ 77 (-28.04%)
Mutual labels:  logback
Logback Chinese Manual
logback 中文手册/文档。
Stars: ✭ 138 (+28.97%)
Mutual labels:  logback
Logback Gelf
Logback appender for sending GELF messages with zero additional dependencies.
Stars: ✭ 146 (+36.45%)
Mutual labels:  logback
Stubbornjava
Unconventional Java code for building web servers / services without a framework. Think dropwizard but as a seed project instead of a framework. If this project had a theme it would be break the rules but be mindful of your decisions.
Stars: ✭ 184 (+71.96%)
Mutual labels:  logback
Logback More Appenders
Extra appenders for Logback.
Stars: ✭ 93 (-13.08%)
Mutual labels:  logback
owasp-security-logging
OWASP Security Logging library for Java
Stars: ✭ 106 (-0.93%)
Mutual labels:  logback
Logstash Logback Encoder
Logback JSON encoder and appenders
Stars: ✭ 1,987 (+1757.01%)
Mutual labels:  logback
logback-access-spring-boot-starter
Spring Boot Starter for Logback-access.
Stars: ✭ 153 (+42.99%)
Mutual labels:  logback
Sofa Common Tools
sofa-common-tools is a library that provide some utility functions to other SOFA libraries.
Stars: ✭ 141 (+31.78%)
Mutual labels:  logback
Okhelper Service
OK帮 云进销存 (SpringBoot Restful 全家桶)
Stars: ✭ 146 (+36.45%)
Mutual labels:  logback
Java Library Examples
💪 example of common used libraries and frameworks, programming required, don't fork man.
Stars: ✭ 204 (+90.65%)
Mutual labels:  logback
Logback Access Spring Boot Starter
Spring Boot Starter for Logback-access
Stars: ✭ 118 (+10.28%)
Mutual labels:  logback
slack-webhook-appender
Logback appender which posts logs to slack via incoming webhook.
Stars: ✭ 16 (-85.05%)
Mutual labels:  logback
Springboot Templates
springboot和dubbo、netty的集成,redis mongodb的nosql模板, kafka rocketmq rabbit的MQ模板, solr solrcloud elasticsearch查询引擎
Stars: ✭ 100 (-6.54%)
Mutual labels:  logback
Tomcat Slf4j Logback
Tomcat, SLF4J and Logback integration Releases
Stars: ✭ 172 (+60.75%)
Mutual labels:  logback
liquibase-slf4j
Liquibase SLF4J Logger.
Stars: ✭ 42 (-60.75%)
Mutual labels:  logback
herald
Log annotation for logging frameworks
Stars: ✭ 71 (-33.64%)
Mutual labels:  logback
logback-gelf-appender
Logback appender that sends GELF messages
Stars: ✭ 38 (-64.49%)
Mutual labels:  logback

logback-mdc-ttl

Maven Central GitHub release License

👉 logback扩展,支持跨线程池的mdc跟踪。

实现上集成使用了Transmittable ThreadLocal(TTL) :在使用线程池等会缓存线程的组件情况下,提供ThreadLocal值的传递功能,解决异步执行时上下文传递的问题。支持JDK 9/8/7/6。

示例

1.项目依赖

<dependency>
    <groupId>com.ofpay</groupId>
    <artifactId>logback-mdc-ttl</artifactId>
    <version>1.0.2</version>
</dependency>

2. 在Java的启动参数加上:

  • -Xbootclasspath/a:/path/to/transmittable-thread-local-2.x.x.jar
  • -javaagent:/path/to/transmittable-thread-local-2.x.x.jar

3. 在logback配置文件中增加TtlMdcListener

<?xml version="1.0" encoding="UTF-8"?>
<configuration >
    <!-- ...(略) -->
    <contextListener class="com.ofpay.logback.TtlMdcListener"/>

    <!--例子:  %X{uuid} 支持在跨线程池时传递-->
    <property scope="context" name="APP_PATTERN"
              value='%d{yyyy-MM-dd HH:mm:ss.SSS}|%X{uuid}|%level|%M|%C\:%L|%thread|%replace(%.-2000msg){"(\r|\n)","\t"}|"%.-2000ex{full}"%n'/>
</configuration>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].