You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using both a StreamHandler and a SocketHandler.
Is there anyway way for my application to run if the StreamHandler is sucessful yet the SocketHandler fails to connect?
I need my app to run - and log to a file (at a minimum) - even if a connection cannot be made to a remote service via SocketHandler.
Assuming the remote service is unavailable ...
When I instantiate the SocketHandler, I receive no errors/exception. However, the first time a logging method is called, an attempt is made to open the connection to the remote service. The connection fails and UnexpectedValueException is thrown. What if the remote service goes down in the middle of my app running? Sudden my app will throw UnexpectedValueException on every logger call. It's not practical to wrap each and every call to a logging function in a try/catch.
It would be great if SocketHandler had an option to say "ignore failed connection."
Does such a capability exist and I'm overlooking it?
The text was updated successfully, but these errors were encountered:
Just encountered same issue. Try...catch isn't working.
I have both GelfHangler sending logs to Graylog and a StreamHandler sending logs to stdout. I took down the graylog server to simulate an outage. When graylog went down, my app also went down throwing RuntimeException error which I tried to catch but for some reason it is not working.
You should wrap the unreliable handlers into a WhatFailureGroupHandler so that errors are ignored if they fail, and they don't bring the whole app down. This has the downside however that if they are misconfigured you'll never really notice though (except by the fact that nothing gets logged).
Monolog version 3
I'm using both a
StreamHandler
and aSocketHandler
.Is there anyway way for my application to run if the
StreamHandler
is sucessful yet theSocketHandler
fails to connect?I need my app to run - and log to a file (at a minimum) - even if a connection cannot be made to a remote service via
SocketHandler
.Assuming the remote service is unavailable ...
When I instantiate the
SocketHandler
, I receive no errors/exception. However, the first time a logging method is called, an attempt is made to open the connection to the remote service. The connection fails andUnexpectedValueException
is thrown. What if the remote service goes down in the middle of my app running? Sudden my app will throwUnexpectedValueException
on every logger call. It's not practical to wrap each and every call to a logging function in a try/catch.It would be great if
SocketHandler
had an option to say "ignore failed connection."Does such a capability exist and I'm overlooking it?
The text was updated successfully, but these errors were encountered: