Skip to content

Commit a5bb8b6

Browse files
committed
add runtime logger to braintrust javaagent
1 parent 3c073a6 commit a5bb8b6

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

braintrust-java-agent/bootstrap/src/main/java/dev/braintrust/system/AgentBootstrap.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ private static boolean isRunningAfterDatadogAgent(List<AgentKind> agents) {
212212
}
213213

214214
private static void enableOtelSDKAutoconfiguration() {
215+
// Silence agent-internal SLF4J output by default
216+
setPropertyIfAbsent("org.slf4j.simpleLogger.log.dev.braintrust", "off");
217+
215218
// Enable OTel SDK autoconfiguration. When anyone first calls
216219
// GlobalOpenTelemetry.get(), the SDK will be built using autoconfigure, which
217220
// discovers our BraintrustAutoConfigCustomizer via ServiceLoader and injects the

braintrust-java-agent/internal/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ dependencies {
2020
// SLF4J API — needed at compile time for Lombok's @Slf4j annotation
2121
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
2222

23+
// SLF4J Simple binding — bundled so the agent always has a logging backend
24+
// (avoids "SLF4J: No SLF4J providers were found" warnings). Log level is set
25+
// to OFF by default via simplelogger.properties so agent internals stay silent.
26+
runtimeOnly "org.slf4j:slf4j-simple:${slf4jVersion}"
27+
2328
// ByteBuddy for bytecode manipulation — bundled as .classdata in BraintrustClassLoader
2429
implementation 'net.bytebuddy:byte-buddy:1.17.5'
2530

0 commit comments

Comments
 (0)