PHPackages                             restrole/laravel-logwithtraceid - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. restrole/laravel-logwithtraceid

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

restrole/laravel-logwithtraceid
===============================

Adds trace\_id to native Laravel logs and returns tid when frontend errors occur.

v1.0.2(6mo ago)09MITPHPPHP ^8.1

Since Oct 28Pushed 6mo agoCompare

[ Source](https://github.com/restrole/laravel-logwithtraceid)[ Packagist](https://packagist.org/packages/restrole/laravel-logwithtraceid)[ RSS](/packages/restrole-laravel-logwithtraceid/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

- [English](README.md)
- [中文](README_zh.md)

Laravel Log Trace ID
====================

[](#laravel-log-trace-id)

This package adds trace IDs to all log messages in your Laravel application. It helps with debugging by providing a unique identifier that can be used to track requests across multiple services or log entries.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require restrole/laravel-logwithtraceid
```

Configuration
-------------

[](#configuration)

The package works out of the box with zero configuration. However, you can publish the config file if you want to customize the behavior:

```
php artisan vendor:publish --tag=laravel-logwithtraceid
```

This will create a config/logwithtraceid.php file with the following options:

- middleware\_groups: The middleware group to automatically register the middleware (default: api)
- header\_name: The HTTP header name to use for the trace ID (default: X-Trace-ID)
- log\_context\_key: The key to use when adding the trace ID to the log context (default: trace\_id)

```
