Skip to content

Commit

Permalink
Reproduce problem
Browse files Browse the repository at this point in the history
  • Loading branch information
bryce-anderson committed Mar 3, 2025
1 parent 8b19324 commit 33dca15
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,19 @@ class DefaultAsyncContextProvider implements AsyncContextProvider {
withInitial(DefaultAsyncContextProvider::newContextMap);

private static final Logger LOGGER = LoggerFactory.getLogger(DefaultAsyncContextProvider.class);
private static final boolean NO_DEBUG_LOGGING = !LOGGER.isDebugEnabled();

static final AsyncContextProvider INSTANCE = new DefaultAsyncContextProvider();
private static final boolean NO_DEBUG_LOGGING;


static {
boolean noDebugLogging = true;
try {
noDebugLogging = !LOGGER.isDebugEnabled();
} catch (Exception ex) {
System.err.println("Couldn't evaluate debug logging: defaulting to false. Cause:\n" + ex);
}
NO_DEBUG_LOGGING = noDebugLogging;
}

protected DefaultAsyncContextProvider() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ServiceTalkThreadContextMapTest {

@BeforeEach
void verifyMDCSetup() {
logger.info("Attempting to log");
assumeTrue(ThreadContext.getThreadContextMap() instanceof ServiceTalkThreadContextMap);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
<PatternLayout pattern="%d %30t a=%X{a} b=%X{b} c=%X{c} [%-5level] %-30logger{1} - %msg%n"/>
</Console>
</Appenders>

<!-- We add the DynamicThresholdFilter to surface cyclical dependencies between MDC logging and the AsyncContext -->
<DynamicThresholdFilter key="USER_ROLE" defaultThreshold="ERROR" onMatch="ACCEPT" onMismatch="DENY">
<KeyValuePair key="ADMIN" value="INFO"/>
<KeyValuePair key="GUEST" value="DEBUG"/>
</DynamicThresholdFilter>

<Loggers>
<Logger name="io.netty" level="info"/>
<Root level="debug">
Expand Down

0 comments on commit 33dca15

Please sign in to comment.