Skip to content

Environments

Auralog groups logs by the environment string you pass to AuralogConfig.builder().environment(...). Use distinct values per deployment so the dashboard can filter cleanly.

Auralog.init(AuralogConfig.builder()
.apiKey(System.getenv("AURALOG_API_KEY"))
.environment(System.getenv().getOrDefault("APP_ENV", "dev"))
.build());

For local dev, consider raising flushInterval or disabling captureErrors to reduce noise:

Auralog.init(AuralogConfig.builder()
.apiKey("aura_dev_key")
.environment("dev")
.flushInterval(Duration.ofSeconds(30))
.captureErrors(false)
.build());

Tests usually want the SDK inert. Either:

  • Skip Auralog.init() — calling Auralog.info(...) without init throws IllegalStateException("Auralog.init(config) must be called before logging"). Catch or guard in test scope.
  • Point at a mock endpoint — use endpoint("http://localhost:1"); sends will fail fast and silently (network errors are swallowed).

Example JUnit 5 setup:

@BeforeAll
static void auralogInit() {
Auralog.init(AuralogConfig.builder()
.apiKey("test")
.environment("test")
.endpoint("http://localhost:1")
.captureErrors(false)
.build());
}
@AfterAll
static void auralogShutdown() {
Auralog.shutdown();
}

For AWS Lambda, Google Cloud Run jobs, scheduled containers, etc.: call Auralog.shutdown() at the end of your handler to guarantee a flush before the process is frozen or terminated.

public class Handler implements RequestHandler<Input, Output> {
@Override
public Output handleRequest(Input event, Context context) {
try {
return doWork(event);
} finally {
Auralog.shutdown();
}
}
}

The auto-registered shutdown hook also fires at interpreter exit, so this is belt-and-braces — but explicit shutdown is faster and more deterministic in serverless contexts.

The SDK ships reachability metadata for GraalVM under META-INF/native-image/ai.auralog/auralog-core/. Spring Boot 3 + native builds work without additional configuration.