swisnl/laravel-graylog2

Logging not disabled even when disabled? Also fails silently.

Closed this issue · 5 comments

So... this doesn't make a lot of sense, but I have logging disabled for Dev + Staging at the moment and it appears that even though I have

'enabled' => env('GRAYLOG_ENABLED', false),

and either nothing in .env or false it's still firing. It doesn't explain why it isn't working, but it's as if it's not actually listening to the config file. I'm also trying to use UDP and it fails when sending a TCP request.

Any ideas?

Ok, this may have been my stupid thing that I did. It appears that when you actually do something like Graylog2::send that even if you've disabled Graylog it still tries to send. Since I had thought it was disabled but still tried to send a message, it failed. However, would it be possible to add something so that no matter what (even if the firewall was closed or something completely tanked in the logging) the package avoided a 500 error?

Basically it was an actual misconfig on the Graylog server that caused all of our issues, but even still - if that server goes down for some reason our app will crash because logging will fail.

Ah yes, there is a difference between the Graylog2 transport and enabling sending the logs trough Monolog. Using the transport directly indeed bypasses the enabled config setting.

However, it should not fail if you have selected UDP as the sending mechanism as it won't care about the other side accepting or dropping the message. It will fail however if the network interface is down or when the hostname does not resolve. Do you have the Exception that you get when it fails?

@WesleyE thanks for the reply. Your response lead me to discover the issue -- apparently udp is not the same as UDP. At some point I moved all of the config to our .env file and when I did that I set everything to udp. It didn't like that and so was sending via TCP.

Man it's amazing anything works at all when you think about it.

Ah, interesting! We check for UDP with caps which is not clear from the readme or config file itself. It also should not have defaulted to TCP with that value. I'll add some code tomorrow to prevent this in the future. Sorry for the confusion!

@WesleyE thanks dude! Appreciate the help - this package is great and has helped me get out of log hell where I have to sift through a bunch of crap all on different servers just to figure out what is happening.