Skip to content

[13.x] fix: respect channel name for on-demand log stacks#60635

Merged
taylorotwell merged 2 commits into
laravel:13.xfrom
maltf0:patch-1
Jul 1, 2026
Merged

[13.x] fix: respect channel name for on-demand log stacks#60635
taylorotwell merged 2 commits into
laravel:13.xfrom
maltf0:patch-1

Conversation

@maltf0

@maltf0 maltf0 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This PR fixes the channel name handling in LogManager::stack(array $channels, $channel = null).

stack() currently passes the second argument to the stack driver config as channel:

$this->createStackDriver([
    'channels' => $channels,
    'channel' => $channel,
]);

However, createStackDriver() resolves the Monolog channel name via parseChannel(), which reads the name key. As a result, the explicit channel name is ignored and Laravel falls back to the application environment name.

For example:

Log::stack(['stack_probe'], 'expected_channel')
    ->getLogger()
    ->getName();

Currently returns the fallback channel name:

'local'

instead of:

'expected_channel'

This PR passes the value using the expected name key and adds a regression test for the explicit channel name.

This is backward compatible: calls without a channel name keep the existing fallback behavior, while calls with an explicit channel name now use it correctly.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@maltf0 maltf0 marked this pull request as ready for review July 1, 2026 12:44
@taylorotwell taylorotwell merged commit 979b838 into laravel:13.x Jul 1, 2026
53 checks passed
@maltf0 maltf0 deleted the patch-1 branch July 1, 2026 16:05
@maltf0 maltf0 restored the patch-1 branch July 1, 2026 16:06
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.

2 participants