Emit diagnostic trace from your Rumi microservices using tracer objects.
Overview
Rumi provides a trace logging framework that allows you to create custom tracers in your application code and emit trace messages at various levels. Tracers are bound to loggers that control trace output destinations and levels.
Creating Tracers
The below code snippet shows an example of creating a Tracer object called "application":
The tracer is created with a default level of INFO meaning that the trace statement in the message handler which is emitted at DEBUG level will not be executed by default.
Trace Levels
Tracers support the following trace levels (in increasing order of verbosity):
SEVERE - Critical errors
WARNING - Warning conditions
INFO - Informational messages
CONFIG - Configuration messages
DIAGNOSE - Diagnostic messages
VERBOSE - Verbose diagnostic messages
DEBUG - Debug messages
Conditional Tracing
For performance, always check the trace level before emitting trace at levels below INFO:
This ensures that expensive string operations or method calls are only executed when the trace level is enabled.
Logging Trace Messages
Once you've created a tracer, use its log() method to emit trace:
Configuring Trace Output
To enable trace output and control where trace is logged, you need to configure:
Trace Levels - Control which trace messages are emitted
Loggers - Named entities that control trace output
Handlers - Destinations for trace output (stdout, files, network, etc.)
For complete information on configuring trace levels, loggers, and handlers, see Trace Logging Configuration.
Quick Configuration Example
To enable debug level for the "application" tracer and bind it to both console and file output: