Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(LogsCollector): support multiple log files #1560

Merged
merged 3 commits into from Mar 24, 2024

Conversation

erikn69
Copy link
Contributor

@erikn69 erikn69 commented Mar 5, 2024

Alternative of #1557

Description

This PR lets users add multiple paths to 'options.logs.file.

Old config:

'logs' => [
    'file' => null,
    // or a single custom file path
    'file' => storage_path('logs/laravel.log'),
],

This PR allows a paths array:

'logs' => [
    'file' => [
        storage_path('logs/laravel.log'),
        // https://laravel.com/docs/10.x/logging#logging-deprecation-warnings
        storage_path('logs/php-deprecation-warnings'),
    ],
],

Note: I've modified the code to be backwards compatible: string values will still work as expected.
Also the logs are sorted by timestamp after they have been merged.

Closes #1556


Removed Laravel 5.0 code fix

// default daily rotating logs (Laravel 5.0)
$path = storage_path() . '/logs/laravel-' . date('Y-m-d') . '.log';
// single file logs
if (!file_exists($path)) {
$path = storage_path() . '/logs/laravel.log';
}

@BrandonOldenhof
Copy link

BrandonOldenhof commented Mar 6, 2024

This PR works but results in a very cluttered log tab.
When you add multiple log files that each receive multiple new entries per second, the resulting tab becomes very unclear

Edit: there's already a "select" functionality for requests. Would it be possible to re-use that functionality for the log files?
image

@erikn69 erikn69 force-pushed the patch-62 branch 2 times, most recently from da4dea1 to 58c51a3 Compare March 6, 2024 20:17
@erikn69
Copy link
Contributor Author

erikn69 commented Mar 6, 2024

Edit: there's already a "select" functionality for requests. Would it be possible to re-use that functionality for the log files?

No, that select is for requests only, something new should be added

When you add multiple log files that each receive multiple new entries per second, the resulting tab becomes very unclear

They were mixed and sorted by timestamp, Maybe i could add the file name to each message Added.

image

@BrandonOldenhof
Copy link

This looks good to me! You've resolved my main issues

@erikn69
Copy link
Contributor Author

erikn69 commented Mar 7, 2024

image
I could also add a second filter group, but maybe it is overloading the tab

@BrandonOldenhof
Copy link

BrandonOldenhof commented Mar 7, 2024

image I could also add a second filter group, but maybe it is overloading the tab

That would make it, in my opinion, easier to use: either view all logs or a subselection.

@erikn69 erikn69 mentioned this pull request Mar 23, 2024
@barryvdh barryvdh merged commit 4aaf214 into barryvdh:master Mar 24, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Support multiple logging channels
4 participants