Skip to content

Commit 3f45b8b

Browse files
committed
up
1 parent da32c80 commit 3f45b8b

File tree

1 file changed

+5
-3
lines changed
  • instrumentation/log4j/log4j-appender-2.17/library/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17

1 file changed

+5
-3
lines changed

instrumentation/log4j/log4j-appender-2.17/library/src/test/java/io/opentelemetry/instrumentation/log4j/appender/v2_17/Log4j2Test.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ protected InstrumentationExtension testing() {
3636

3737
@Override
3838
protected List<AttributeAssertion> addCodeLocationAttributes(String methodName) {
39-
// Library instrumentation does not capture code location in older versions.
40-
// Code location is only available when using latest deps (which have the necessary APIs).
41-
if (!Boolean.getBoolean("testLatestDeps")) {
39+
// For library tests, AsyncLogger can't capture code location in older versions
40+
String selector = System.getProperty("Log4j2.contextSelector");
41+
boolean async = selector != null && selector.endsWith("AsyncLoggerContextSelector");
42+
if (async && !Boolean.getBoolean("testLatestDeps")) {
43+
// source info is not available by default when async logger is used in non latest dep tests
4244
return new ArrayList<>();
4345
}
4446

0 commit comments

Comments
 (0)