-
Notifications
You must be signed in to change notification settings - Fork 44
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
ConvertToArrayFilter: System.ArgumentNullException: Value cannot be null #72
Comments
Try using this line instead: |
We rely on IDisposable returned from Push. Could you help us understand how this will fix the ArgumentNullException? |
Look at https://github.com/urielha/log4stash/blob/master/src/log4stash/LogEvent/BasicLoggingEventParser.cs line 111 method. |
Based on my experiments it is a bug ConvertToArrayFilter. When I turn it off by removing So based on that, the issue is not related to Properties vs Stack. We've been using Stack for a long time and it always, and still, works. |
You are right, it does work, my bad :) |
We remove "Alice" by calling IDisposable.Dispose. I updated the bug description with a code sample. |
From what I see, since you dispose "Alice" before logging without popping it from the stack it stays null and therefore causes the exception, |
My understanding is that explicit Pop call is not required. Based on log4net documentation for the Push, they seem to recommend this pattern:
|
It was my understanding too, but in fact that's what happens when debugging the code |
I have do a bit more research on this, but IMHO ToArray filter needs to be fixed to behave like ToString filter. ToString does not crash in the same scenario. |
We are getting this exception when trying to log with log4stash 3.0.0 and log4net 2.0.11.
Not sure if it is related but we use custom log4net code like
LogicalThreadContext.Stacks["FirstName"].Push("Alice")
With log4stash config like
Edit: Code to reproduce the issue:
The text was updated successfully, but these errors were encountered: