monolog-bundle
monolog-bundle copied to clipboard
symfony 5.4 to 6.x || symfony/monolog-bundle": "^3.7.1" issue with UdpSocket
After upgrading symfony 5.4 to 6.x i always get :
NOTICE: PHP message: PHP Fatal error: Uncaught RuntimeException: The UdpSocket to ..XX.. has been closed and can not be written to anymore in /srv/api/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php:63
My monolog config
syslogudp:
type: syslogudp
host: '%env(resolve:SYS_LOG_UDP_HOST)%'
port: '%env(resolve:SYS_LOG_UDP_PORT)%'
persistent: true
formatter: monolog.formatter.json
level: info
this current config work very well with symfony 5.4 and monolog 3.5
please try upgrading monolog-bundle and monolog separately to see which one has an issue.
@stof thx for your reply
I upgrade monolog-bundle and monolog
"symfony/monolog-bundle": "^v3.7.1",
now i have this
when@dev:
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: [ "!event" ]
syslogudp:
type: syslogudp
host: '%env(resolve:SYS_LOG_UDP_HOST)%'
port: '%env(resolve:SYS_LOG_UDP_PORT)%'
persistent: true
formatter: monolog.formatter.json
level: info
facility: "lpr"
Stack trace:
2022-04-27T14:38:22.726550716Z #0 /srv/api/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php(49): Monolog\Handler\SyslogUdp\UdpSocket->send('<54>1 2022-04-2...')
2022-04-27T14:38:22.726553371Z #1 /srv/api/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php(77): Monolog\Handler\SyslogUdp\UdpSocket->write('{"message":"Dis...', '<54>1 2022-04-2...')
2022-04-27T14:38:22.726555696Z #2 /srv/api/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(48): Monolog\Handler\SyslogUdpHandler->write(Array)
2022-04-27T14:38:22.726557599Z #3 /srv/api/vendor/monolog/monolog/src/Monolog/Logger.php(328): Monolog\Handler\AbstractProcessingHandler->handle(Array)
2022-04-27T14:38:22.726559363Z #4 /srv/api/vendor/monolog/monolog/src/Monolog/Logger.php(527): Monolog\Logger->addRecord(200, 'Disconnecting', Array)
2022-04-27T14:38:22.726561166Z #5 /srv/api/vendor/doctrine/dbal/src/Logging/Connection.php(30): Monolog\Logger->info('Disconnecting')
2022-04-27T14:38:22.726562879Z #6 [internal function]: Doctrine\DBAL\Logging\Connection->__destruct()
2022-04-27T14:38:22.726564643Z #7 {main}
with nx i can easly print some infos on my container "logger" with that command
nc -u logger 6000
so my container is reachable
Related: doctrine/dbal#5340
I did fix the UdpSocket issue in https://github.com/Seldaek/monolog/releases/tag/2.6.0 so that the socket will reopen on demand, which should fix the issue here.