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

symfony 5.4 to 6.x || symfony/monolog-bundle": "^3.7.1" issue with UdpSocket #435

Open
Khatib-Abbas opened this issue Apr 27, 2022 · 4 comments

Comments

@Khatib-Abbas
Copy link

Khatib-Abbas commented Apr 27, 2022

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

@stof
Copy link
Member

stof commented Apr 27, 2022

please try upgrading monolog-bundle and monolog separately to see which one has an issue.

@Khatib-Abbas
Copy link
Author

Khatib-Abbas commented Apr 27, 2022

@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

@derrabus
Copy link
Member

Related: doctrine/dbal#5340

@Seldaek
Copy link
Member

Seldaek commented May 10, 2022

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.

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

4 participants