jjchiw / gelf4net

GELF log4net Appender - graylog2
MIT License
63 stars 59 forks source link

Blocks the application if graylog server is not reachable #39

Closed mitulmakadia closed 8 years ago

mitulmakadia commented 8 years ago

While working on server migration, we accidentally forget to allow graylog server in firewall. The log statement was pausing the code execution due to unreachable Graylog server upto 20 seconds before stepping forward.

This poses a serious risk to production environment. Is there anyway we can have log statements are executed asynchronously?

jjchiw commented 8 years ago

I'll look into that gelf4net should not block the execution.

About the async appender I thought it was merged in master it's still in a separate branch https://github.com/jjchiw/gelf4net/tree/async-appenders

I'll merge them during the weekend and look into the app blocking

mitulmakadia commented 8 years ago

Thanks jjchiw! Looking forward to it. This has been proving helpful to us so far.

jjchiw commented 8 years ago

Hi, I remembered why I didn't add the asyncappenders was because we didn't finish the testing https://github.com/jjchiw/gelf4net/pull/27 I'll merge it since wjdavid5 said that it's being used in production....

About the 20 seconds delay, I added a Stopwatch in https://github.com/jjchiw/gelf4net/tree/master/examples/SimpleConsoleApplication and I can not reproduce the delay.

I uploaded a new version with the asyncappenders https://www.nuget.org/packages/Gelf4Net/2.0.3.16

ghost commented 8 years ago

Hi jjchiw,

I tried using HttpAppender from the new version (2.0.3.16) but faced the issue where application got blocked and took around 20 seconds to respond. However, AsyncUdpAppender worked well. Not sure about the issue with HttpAppender.

Thanks

jjchiw commented 8 years ago

About the application that got blocked, I can not reproduce it, in the example https://github.com/jjchiw/gelf4net/tree/master/examples/SimpleConsoleApplication where I use the three appender UdpAppender, AsyncUdpAppender, HttpAppender and I have graylog turned off, the applications do not hangs....

I don't know if I can look into that....

Great you got it working with the AsyncUdpAppender.