serilog / serilog-enrichers-thread Goto Github PK
View Code? Open in Web Editor NEWEnrich Serilog events with properties from the current thread.
License: Apache License 2.0
Enrich Serilog events with properties from the current thread.
License: Apache License 2.0
In a lightly multithreaded application it might be useful to remove ThreadId=1 (or a configurable ID if needed) to decrease noise in logs and leave the IDs only for non-main threads.
Hi,
would you mind an additional enricher which adds the thread name?
I would start with the implementation after merging #9 .
We are experiencing a number of cases when we see an error with this kind of stack trace:
2020-04-20T08:38:17.5145399Z Exception while emitting periodic batch from Serilog.Sinks.MSSqlServer.MSSqlServerSink: System.ArgumentException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).Couldn't store <"7526f485-ec2d-4ec8-bd73-12a7d1c49a5d"> in UserId Column. Expected type is Guid.
---> System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
at System.Guid.GuidResult.SetFailure(Boolean overflow, String failureMessageID)
at System.Guid.TryParseExactD(ReadOnlySpan1 guidString, GuidResult& result) at System.Guid.TryParseGuid(ReadOnlySpan
1 guidString, GuidResult& result)
at System.Guid..ctor(String g)
at System.Data.Common.ObjectStorage.Set(Int32 recordNo, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)
--- End of inner exception stack trace ---
at System.Data.DataColumn.set_Item(Int32 record, Object value)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at Serilog.Sinks.MSSqlServer.MSSqlServerSink.FillDataTable(IEnumerable1 events) at Serilog.Sinks.MSSqlServer.MSSqlServerSink.EmitBatchAsync(IEnumerable
1 events)
at Serilog.Sinks.PeriodicBatching.PeriodicBatchingSink.OnTick()
This arises when using LogContext.PushProperty("UserId", someGuid);
someGuid is a Guid type variable, and contains a valid Guid.
It is not easily reproducible, unfortunately, but the end result is that our log entries are not being written when this kicks in.
I posted on StackOverflow some months ago with this issue, but have been unable to resolve it satisfactorily.
Wondering if there was any insight that could be offered? I'm not sure if it is an issue with serilog-enrichers-thread or with the sql server sink. I'm starting here, as the issue only arises in connection with items added with PushProperty.
Edited to Add:
This stackoverflow link from 4 years ago seems related: https://stackoverflow.com/questions/35178415/unable-to-log-in-ms-sql-using-serilog
It looks like the CI builds for the dev branch are failing because the nuget API key has expired.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.