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

To use trigger_error instead of error_log #1473

Open
enginvardar opened this issue Jan 9, 2025 · 2 comments
Open

To use trigger_error instead of error_log #1473

enginvardar opened this issue Jan 9, 2025 · 2 comments

Comments

@enginvardar
Copy link

Is your feature request related to a problem?

When the logger is not set to LogHolder but a generic error handler is set in application that is set by set_error_handler, error handler is not invoked because error_log function does not trigger this.

Describe the solution you'd like
To use trigger_error instead of error_log in ErrorLogWriter to allow error handler to handle logging.

What would you think about a change like this?

@brettmc
Copy link
Collaborator

brettmc commented Jan 9, 2025

I'm not sure that we want that as default behaviour, wouldn't this mean runtime opentelemetry exceptions would/could break the observed application? https://opentelemetry.io/docs/specs/otel/error-handling/#basic-error-handling-principles

@enginvardar
Copy link
Author

Yes, depending on the error handler implementation the log might turn into unhandled exception and the application could break.

What would you think about adding a "trigger_error" option to LogWriterFactory so we use it only if it is set intentionally?

I am now moving to psr3 logger for my case, but almost all containerized applications need some kind of special formatting for logging and my assumption was that I would be able to handle all logging in the error handler.

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

No branches or pull requests

2 participants