-
Notifications
You must be signed in to change notification settings - Fork 9
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
Message and exception provided via LoggingEvent created from LoggingEventData is not sent to Elastic Search #6
Comments
Hi @lawrencejohnston, will update you soon. By the way, |
Hi @urielha Thanks! I'll take a look at FixFlags.All vs FixFlags.Partial for my code. I'm using it to stop log4net from dynamically populating fields that I'm not setting explicitly in the event (like the thread name). It may be that as long as in my appenders I'm only using fields included in FixFlags.Partial that that would be fine. |
@lawrencejohnston , One more thing, Thanks |
We're using The object we're logging is a
|
I'm little busy those days so I will look at it ASAP. |
Hi @lawrencejohnston, Try to insert the ExceptionString into a property of the loggingEvent: var eventData = new LoggingEventData {
// ....
};
eventData.Properties["TheException"] = "Exception string";
var loggingEvent = new LoggingEvent(eventData);
ILogger logger = ... // Get ILogger
logger.Log(loggingEvent) let me know if this worked for you. And one question: Best regards |
Yes, that's how we're getting an That workaround seems like it would work, but for now we're using a local fork with the changes described in the first post. As soon as the issues we've encountered are fixed and released we'll switch back to the NuGet version. |
Fixed with commit 560676d |
We have a remote system that submits information to be logged to our server. This information includes the message and sometimes exception data.
On our server we then log the message using log4net like this:
Everything works as expected when using a log4net FileAppender, but when submitted to Elastic Search using log4stash the message and exception are not sent.
I tracked this down to the ElasticSearchAppender implementation where it gets the message from
loggingEvent.MessageObject.ToString()
and the exception fromloggingEvent.ExceptionObject.ToString()
. A LoggingEvent created from LoggingEventData does not have values for these properties.It seems like the correct place to get this information is
loggingEvent.RenderedMessage
andloggingEvent.GetExceptionString()
.Note that
GetExceptionString()
returns an empty string rather than null if no exception information is provided, so you'll probably need to usingstring.IsNullOrEmpty()
when checking whether or not there's exception information to send.The text was updated successfully, but these errors were encountered: