Closed vitekzach closed 5 years ago
Hi - it’s been a while since I looked at that code, I’ll have a poke around and get back to you :)
Ok, so I think you might be able to do what you want by sub-classing SeqLogHandler
and overriding emit
to modify the log entry properties as required.
From memory, the stack trace (if available) is called sinfo
or stack_info
.
Oh, I see, @x
is a root body property. No, I don't think there's a trivial way to do that the way the code is right now (I'd not seen that property when seqlog was first written).
@nblumhardt - do you know if older versions of Seq will accept log payloads that contain unrecognised properties on the root object in the payload?
I think we could probably modify seqlog to send @x
if exc_info
is available on the log record, but we might need to have some sort of switch to turn on this behaviour, if older versions of Seq won't accept requests whose body contains it
Sorry, @nblumhardt, a simpler question if you please - what's the oldest version of Seq whose raw event-ingestion API supports the compact format (which is what I assume we're talking about when it comes to @x
and friends)?
(I'm still on Seq v3.4 as the last paid version I can use, so I'd like to not break logging for myself if possible)
Hi Adam! Seq versions from 3.3 onward supports compact format, and @x
is understood from right back at that version, so on 3.4 this will be fine 👍
Ok, thanks - will switch it over then! :)
Ok, not using the compact format for now (bit of a PITA to serialise JSON line-by-line) but @x
is equivalent to Exception
so I've been able to still pass exception details to Seq if they're available.
Are you able to give 544438c a try? If it works for you, I'll publish it to PyPI
Amazing @tintoy , it does work! Do I understand it right exc_info has to be True? Does this work in only in an except block?
Thank you for the fix, it does work as expected for me. (and it helps to bring it up to the same level as other logging packages, as this is what our .NET apps logging to seq use to log errors by default).
As I understand it, yes that’s the case. Or anything truthy at least.
I’ll get the package published tomorrow morning then :)
Works perfect, thank you so much! :)
Hi,
when I'm logging errors, I can include the traceback just fine, but I would like to fill the @x property of the underlying JSON body with it instead of just a generic one - is it possible short of using POST requests to achieve this?