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

Add logging to error rendering failures #17615

Merged
merged 2 commits into from
Mar 11, 2024
Merged

Add logging to error rendering failures #17615

merged 2 commits into from
Mar 11, 2024

Conversation

markstory
Copy link
Member

When error rendering fails it can be tedious to diagnose what the problem is. Having some logging when rendering fails could help triage the problem and get to a solution quicker.

Refs #17603

@markstory markstory added this to the 5.0.7 milestone Mar 10, 2024
When error rendering fails it can be tedious to diagnose what the
problem is. Having some logging when rendering fails could help triage
the problem and get to a solution quicker.

Refs #17603
Log::warning(
"Failed to construct or call startup() on the resolved controller class of `$class`. " .
"Using Fallback Controller instead. Error {$e->getMessage()}",
'cake.error'
Copy link
Member Author

Choose a reason for hiding this comment

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

New logging has a scope so folks can silence this scope if required. If this is happening frequently in an application I think the application is broken 🤷

Copy link
Member

Choose a reason for hiding this comment

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

Why do we need cake.error if we have log levels? Why not just cake?

Copy link
Member Author

Choose a reason for hiding this comment

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

Why do we need cake.error if we have log levels? Why not just cake?

I could see a scenario where folks have existing applications that they want to get warnings from but not this warning. Having routes based on module/package names felt like a natural pairing with namespaces. I use a similar approach in python applications and it gives you a lot of flexibility in how you can configure logging from your application.

@markstory markstory merged commit cf58fd1 into 5.x Mar 11, 2024
10 checks passed
@markstory markstory deleted the error-renderer-log branch March 11, 2024 04:19
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.

None yet

3 participants