Download the PHP package open-telemetry/opentelemetry-logger-monolog without Composer
On this page you can find all versions of the php package open-telemetry/opentelemetry-logger-monolog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download open-telemetry/opentelemetry-logger-monolog
More information about open-telemetry/opentelemetry-logger-monolog
Files in open-telemetry/opentelemetry-logger-monolog
Package opentelemetry-logger-monolog
Short Description OpenTelemetry Monolog handler.
License Apache-2.0
Homepage https://opentelemetry.io
Informations about the package opentelemetry-logger-monolog
This is a read-only subtree split of https://github.com/open-telemetry/opentelemetry-php-contrib.
OpenTelemetry Monolog handler
A monolog handler for OpenTelemetry. See https://opentelemetry.io/docs/instrumentation/php/manual/#logs for further documentation.
Requirements
API + SDK
This package depends on the OpenTelemetry API, but a configured OpenTelemetry SDK should also be provided.
Exporter
Usually logs are exported to a receiver
via the otlp
protocol in the protobuf
format, via http or gRPC
.
This requires:
- a
protobuf
implementation; either the protobuf extension or thegoogle/protobuf
package - the
open-telemetry/exporter-otlp
package - the
open-telemetry/transport-grpc
package, if using gRPC transport - a PSR-7 and PSR-18 implementation, if using HTTP transport
Receiver
Logs must be emitted to a receiver/system that understands the OpenTelemetry protocol, such as the OpenTelemetry collector.
Installation
Usage
The OpenTelemetry handler, configured with an OpenTelemetry LoggerProvider
, is used to send Monolog LogRecord
s to OpenTelemetry.
The LoggerProvider
can be configured in a number of ways: manually, via an SDK Builder, or automatically (using environment/php.ini variables).
Manual configuration
Set up an SDK LoggerProvider and pass it to the handler:
Automatic configuration
If you use OpenTelemetry SDK autoloading, you can retrieve the global logger provider. That may be a no-op implementation if there was any misconfiguration.
See autoload-sdk example for how to use autoloading with the OpenTelemetry SDK.
Create a Logger
Finally, add the handler to a Monolog logger: