jjchiw / gelf4net

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

AMQP appender brings down IIS W3WP.exe #33

Closed scottEdwardsAllanGray closed 8 years ago

scottEdwardsAllanGray commented 8 years ago

If you configure the AMQP appender incorrectly (e.g. change to a non-existent host like , the appender throws an exception that brings down W3WP.exe.

This happens here in GelfAmqpAppender.cs: protected override void OnClose() { Channel.Close(); Channel.Dispose(); Connection.Close(); Connection.Dispose(); }

If you change this code as follows, the problem goes away: protected override void OnClose() { if (Channel != null) { Channel.Close(); Channel.Dispose(); } if (Connection != null) { Connection.Close(); Connection.Dispose(); } }

So, either Channel or Connection are null (not sure which).

Stack traces from the Windows application log, in order, are as follows: 001.txt 002.txt 003.txt

jjchiw commented 8 years ago

Thanks! I merged the changes of the PR #34

scottEdwardsAllanGray commented 8 years ago

Superb! Thank you.

jjchiw commented 8 years ago

:)