kphcdr/laravel-trace-id

laravel log append trace id

v1.1.0 2024-08-23 06:17 UTC

This package is auto-updated.

Last update: 2024-11-23 06:46:05 UTC


README

usage

config

logger.php 

        'stdout' => [
            'driver' => 'monolog',
            'handler' => StreamHandler::class,
            'with' => [
                'stream' => 'php://stdout',
            ],
            'tap' => [\Trace\TraceInvoke::class], #new line
        ],

in http

append to webMiddleware group

WithTraceHttpMiddleware::class

in jobs

    public function middleware()
    {
        return [WithTraceJobMiddleware::class];
    }

tracking

put header X-Trace-Id:Any string

example

[2022-06-20 20:37:49] local.INFO: hello trace id [62b06a1d42fe8]