kphcdr/laravel-trace-id

laravel log append trace id

v1.0.4 2022-07-15 06:41 UTC

This package is auto-updated.

Last update: 2024-02-15 10:15:37 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]