Logger facade sends log records directly to the OpenTelemetry Logs SDK, bypassing Laravel’s Monolog-based logging pipeline. Each log record is emitted as an OpenTelemetry\API\Logs\LogRecord with the correct severity, timestamp, and any attributes you provide.
When the
otlp log channel is used (via Laravel’s Log facade), the trace ID of the active span is automatically correlated to the log record inside the exporter. When using the Logger facade directly, the same trace correlation applies without any extra configuration.Log level methods
All level methods share the same signature:The log message body.
An associative array of additional attributes to attach to the log record. Each key-value pair is set as an attribute on the underlying
LogRecord.emergency()
System is unusable.
alert()
Action must be taken immediately.
critical()
Critical conditions, such as an unexpected exception that halted a request.
error()
Runtime errors that do not require immediate action but should be monitored.
warning()
Exceptional occurrences that are not errors but indicate something unexpected.
notice()
Normal but significant events.
info()
Interesting runtime events such as startup messages, progress updates, or audit trails.
debug()
Detailed diagnostic information, typically of interest only when diagnosing problems.
log()
Emits a log record at an arbitrary PSR-3 severity level.
A PSR-3 log level string:
'emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', or 'debug'.The log message body.
Additional attributes to attach to the log record.
Context attributes
Every key-value pair in the$context array is attached to the LogRecord as an attribute:
If
opentelemetry.logs.inject_trace_id is enabled in your config (it is by default) and you pass the configured trace_id_field key in $context, it will be silently removed — the SDK handles trace correlation automatically.User context
Whenopentelemetry.user_context is true (the default) and a user is authenticated, the Logger facade automatically resolves and attaches user context attributes to every emitted log record. The default attribute is user.id, but you can customize it via OpenTelemetry::user().
Comparison with the otlp log channel
The package also ships with an otlp log channel that integrates with Laravel’s Log facade through Monolog:
| Feature | Logger facade | otlp channel (Monolog) |
|---|---|---|
| Emits to OTel Logs SDK | Yes | Yes |
| Laravel log stack integration | No | Yes |
| PSR-3 compatible | Yes | Yes |
| User context auto-attached | Yes | Depends on handler |
| Trace correlation | Automatic | Automatic |
Logger facade when you want to emit telemetry-first log records without going through Monolog. Use the otlp channel when you want the record to flow through Laravel’s log stack (e.g. to be sent to multiple channels simultaneously).