This bundle adds a monolog processor to the OpentracingBundle to automatically enrich log contexts with the current span context.
This bundle is only an additional plugin and should not be installed independently. See its documentation for more information on installing the OpentracingBundle first.
After you have installed the OpentracingBundle:
- require the dependencies:
composer req auxmoney/opentracing-bundle-monolog
If you are using Symfony Flex, you are all set!
If you are not using it, you need to manually enable the bundle:
- add bundle to your application:
# Symfony 3: AppKernel.php
$bundles[] = new Auxmoney\OpentracingMonologBundle\OpentracingMonologBundle();
# Symfony 4+: bundles.php
Auxmoney\OpentracingMonologBundle\OpentracingMonologBundle::class => ['all' => true],
No configuration is necessary, the Monolog bundle extension will automatically load the provided Processor
by tag.
Whenever a message is logged, the content is extended with extra information of the span context.
[2020-01-10 11:38:03] php.INFO: .... {"exception":"[object] (ErrorException(code: 0) ...."} {"opentracing-context":"{\"UBER-TRACE-ID\":\"15e880402e1a194715e880402e19a3e0:15e880402e19a3e0:0:1\"}"}
Be sure to run
composer run-script quality
every time before you push code changes. The tools run by this script are also run in the CI pipeline.