Giter Site home page Giter Site logo

Message and exception provided via LoggingEvent created from LoggingEventData is not sent to Elastic Search about log4stash-old HOT 8 CLOSED

RedwoodForest avatar RedwoodForest commented on August 23, 2024
Message and exception provided via LoggingEvent created from LoggingEventData is not sent to Elastic Search

from log4stash-old.

Comments (8)

urielha avatar urielha commented on August 23, 2024

Hi @lawrencejohnston,
I will look at it ASAP, in the past I removed the reference to loggingEvent.RenderedMessage cause I saw no difference..
Maybe it's my fault.

will update you soon.
Thanks!!

By the way,
Are you sure you want to do this: loggingEvent.Fix = FixFlags.All ?
Consider that this has a performance hit, maybe FixFlags.Partial will be enough for you :)

from log4stash-old.

RedwoodForest avatar RedwoodForest commented on August 23, 2024

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.

from log4stash-old.

urielha avatar urielha commented on August 23, 2024

@lawrencejohnston ,
Are you using ILogger from a reason? why don't you use the regular ILog?

One more thing,
The object you are logging is of Exception type? or it's just the LoggingEvent?
I'm trying to build a test upon it so we can be sure we got the right behavior.

Thanks

from log4stash-old.

RedwoodForest avatar RedwoodForest commented on August 23, 2024

We're using ILogger because it has a Log method that accepts a LoggingEvent (rather than just a string and exception). We need to use a LoggingEvent because the data is coming from a remote system and already has TimeStamp/ThreadName/Exception (serialized to a string) information.

The object we're logging is a LoggingEvent with the ExceptionString property set. Something like this should work for your test:

var eventData = new LoggingEventData {
    ExceptionString = "Any string" // Can make it look more like Exception.ToString() if you want, but any string will do
    // Any other properties you want to test...
};

var loggingEvent = new LoggingEvent(eventData);

ILogger logger = ... // Get ILogger
logger.Log(loggingEvent)

from log4stash-old.

urielha avatar urielha commented on August 23, 2024

I'm little busy those days so I will look at it ASAP.
Thanks!

from log4stash-old.

urielha avatar urielha commented on August 23, 2024

Hi @lawrencejohnston,
It's taking me more time than I thought, but I think you can workaround this issue.

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:
can you tell me how exactly you extract the ILogger? are you using ILog.Logger member?

Best regards

from log4stash-old.

RedwoodForest avatar RedwoodForest commented on August 23, 2024

Yes, that's how we're getting an ILogger.

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.

from log4stash-old.

urielha avatar urielha commented on August 23, 2024

Fixed with commit 560676d

from log4stash-old.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.