Skip to content

Fix PHP Monolog LogsHandler constructor in logs docs - #19640

Merged
Litarnus merged 5 commits into
getsentry:masterfrom
Hashim1999164:fix/php-logs-monolog-handler-ctor
Oct 13, 2026
Merged

Litarnus merged 5 commits into
getsentry:masterfrom
Hashim1999164:fix/php-logs-monolog-handler-ctor

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Sep 25, 2026 •

Copy link
Copy Markdown

DESCRIBE YOUR PR

Fixes #19177

The PHP logs setup snippet still constructed LogsHandler with a Hub argument. In sentry/sentry 4.x that constructor only takes a log level (and bubble), so the sample failed as written. Updated it to match the working 4.x call.

IS YOUR CHANGE URGENT?

  • Urgent deadline (GA date, etc.): YYYY-MM-DD
  • Other deadline: YYYY-MM-DD
  • No deadline: Not urgent, can wait up to 1 week+

PRE-MERGE CHECKLIST

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Test plan

LogsHandler in sentry/sentry 4.x only takes a level (and bubble). The
logs setup snippet still passed a Hub, so the sample could not run.
@vercel

vercel Bot commented Sep 25, 2026

Copy link
Copy Markdown

@Hashim1999164 is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the Priority: Needs Triage The PR description is missing valid priority information label Sep 25, 2026
@codeowner-assignment
codeowner-assignment Bot requested a review from a team September 25, 2026 23:11
@github-actions github-actions Bot added Priority: Normal Docs review has no urgent deadline and removed Priority: Needs Triage The PR description is missing valid priority information labels Sep 26, 2026
@coolguyzone
coolguyzone requested a review from cleptric October 1, 2026 20:05
@cleptric
cleptric requested review from Litarnus and removed request for cleptric October 5, 2026 20:52
]);

$log = new Logger('app');
$log->pushHandler(new \Sentry\Monolog\LogsHandler(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, LogsHandler is (logLevel, bubble). updated the sample to pass true for bubble. Monolog\Level::Info is still valid there too (constructor takes LogLevel|Monolog\Level|int).

LogsHandler takes (logLevel, bubble). Keep the level and set bubble true so the sample matches the constructor.
@Hashim1999164
Hashim1999164 force-pushed the fix/php-logs-monolog-handler-ctor branch from 0a08b13 to da3cf18 Compare October 6, 2026 19:02
@Hashim1999164

Copy link
Copy Markdown
Author

good catch, LogsHandler is (logLevel, bubble). updated the sample to pass true for bubble.

Comment thread platform-includes/logs/setup/php.mdx Outdated
@Litarnus

Litarnus commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Hi @Hashim1999164! It's a bit unfortunate but we added a 3rd parameter in todays release: https://github.com/getsentry/sentry-php/blob/master/src/Monolog/LogsHandler.php#L46

Could you update it, the rest looks good

@Hashim1999164

Copy link
Copy Markdown
Author

@Litarnus updated, added the third includeChannel arg (false) so the sample matches the current LogsHandler ctor.

LogsHandler now takes (logLevel, bubble, includeChannel). Keep the sample
in sync with the current constructor.
@Hashim1999164
Hashim1999164 force-pushed the fix/php-logs-monolog-handler-ctor branch from cdcd517 to 4eb546a Compare October 9, 2026 19:38
@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
develop-docs Ready Ready Preview Oct 13, 2026 11:58am UTC
sentry-docs Ready Ready Preview Oct 13, 2026 11:58am UTC

Request Review

@Litarnus
Litarnus merged commit d68bb11 into getsentry:master Oct 13, 2026
22 checks passed

This branch was successfully deployed

2 active deployments
Preview – sentry-docs — e93a1998 Deployed Oct 13, 2026 by vercel[bot]
Preview – develop-docs — e93a1998 Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: Normal Docs review has no urgent deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Monolog Log Handler is using old constructor parameters

5 participants