Comments (4)
The problem seems to be bubble: false in the first handler, that means it'll stop propagating messages to other handlers.
Another note, I would remove the group and the streamed handler from grouped_critical, because it will already receive errors from grouped_error, resulting in duplicate entries in the log file.
So this should work:
parameters:
error_mail_sender: [email protected]
error_mail_recipients: [[email protected]]
critical_error_mail_recipients: [[email protected], [email protected]]
monolog:
handlers:
main_critical:
type: fingers_crossed
action_level: critical
handler: buffered_critical
buffered_critical:
type: buffer
handler: swift_critical
swift_critical:
type: swift_mailer
from_email: %error_mail_sender%
to_email: %error_mail_recipients%
subject: Critical error occurred!
level: debug
main_error:
type: fingers_crossed
action_level: error
handler: grouped_error
grouped_error:
type: group
members: [streamed, buffered_error]
streamed:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
buffered_error:
type: buffer
handler: swift_error
swift_error:
type: swift_mailer
from_email: %error_mail_sender%
to_email: %critical_error_mail_recipients%
subject: Non-critical error occurred
level: debug
I reordered them to make it easier to see the two handler chains as well.
from monolog.
Thanks a lot for the reply! It is almost there now, however the only thing is that Critical errors are firing 2 emails, one from each handler. That's why I thought to add the bubble: false
previously. I tried adding it back in but it doesn't seem to work
Is it possible to remove the second email for critical errors?
from monolog.
You can only filter down and not up, so you can't split the levels into =CRITICAL. That said, the problem seems to be that critical_error_mail_recipients contains the [email protected], but that one doesn't need to be there, since they'll already get a mail in case of simple errors. Just removing this should make sure everyone gets at most one mail.
from monolog.
Right yeah I thought that might be the case.
Thanks a lot for your help and explanations :)
from monolog.
Related Issues (20)
- The file does not close after writing HOT 5
- How do I use includeStacktraces? HOT 1
- Support more flexible normalizer HOT 2
- cannot access private method HOT 7
- Add support for Elasticsearch with Bulk API and data stream HOT 1
- Could a new release be considered to remove the 0.7MB logo from the package ? HOT 1
- Uncaught Error: Class "Monolog\Logger" not found HOT 7
- User definable duplication for DeduplicationHandler
- Encounter problem in format function HOT 3
- DatetimeImmutable HOT 1
- [Discussion] Reset FingersCrossedHandler on stateful runtimes HOT 8
- Extending Processors - private properties HOT 1
- Incorrect logs are written in Monolog files intermittently HOT 1
- Truncated JsonFormatter logs at 8191 characters HOT 5
- Log Message is truncated HOT 1
- Log level not compliant with rfc5424 HOT 2
- DeduplicationHandler in a read only container HOT 4
- IntrospectionProcessorTests: $expect and $actual are the same object by reference.
- Php 8.3 compatibility issue HOT 5
- Adding postParams in ERROR notice for HTTP 405 code HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monolog.