Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 18 13:55

    serilog-build on v105

    (compare)

  • Jan 18 13:55

    ThomasArdal on master

    Set correlationId from properti… 3.7 in prerelease (compare)

  • Jan 18 07:48

    serilog-build on v104

    (compare)

  • Jan 18 07:48

    ThomasArdal on master

    Replaced ASP.NET Core 2.2 sampl… Replaced ASP.NET Core 2.2 sampl… Comments on all settings in con… and 3 more (compare)

  • Jan 12 22:48

    nblumhardt on dev

    Fix the naming of the configura… Update projects/build Semicolon, not comma and 1 more (compare)

  • Jan 08 00:10

    serilog-build on v2.4.0

    (compare)

  • Jan 08 00:03

    nblumhardt on dev

    Added notes about Log Scope usa… Tweaked some wording in the Log… Merge pull request #182 from Ra… (compare)

  • Jan 06 23:36

    nblumhardt on dev

    Suppress ExecutionContext flowi… Removed DisableImplicitFramewor… Merge pull request #53 from Cod… (compare)

  • Jan 04 05:56

    nblumhardt on dev

    Including the RollingFileSink i… Merge pull request #196 from pv… (compare)

  • Dec 22 2020 05:15

    nblumhardt on renderings-property

    (compare)

  • Dec 22 2020 05:14

    nblumhardt on dev

    Test templates by comparing out… Merge pull request #20 from ser… (compare)

  • Dec 22 2020 05:01

    nblumhardt on renderings-property

    Test templates by comparing out… (compare)

  • Dec 15 2020 22:27

    nblumhardt on dev

    Update publishing key; fixes #11 (compare)

  • Dec 15 2020 07:02

    serilog-build on v103

    (compare)

  • Dec 15 2020 07:01

    ThomasArdal on master

    New nuget api key (compare)

  • Dec 15 2020 04:09

    nblumhardt on dev

    Replace PackageLicenseUrl with … Merge pull request #43 from Num… (compare)

  • Dec 15 2020 04:07

    nblumhardt on dev

    Only reference System.Diagnosti… Merge pull request #10 from Num… (compare)

  • Dec 13 2020 12:20

    ThomasArdal on master

    Updated nuget api key (compare)

  • Dec 13 2020 12:17

    ThomasArdal on master

    Added icon (compare)

  • Dec 13 2020 12:17

    ThomasArdal on master

    Fixed nuget package issue (compare)

Nicholas Blumhardt
@nblumhardt
@JonRoosevelt if you use this Kafka sink - I can see that it accepts an ITextFormatter:
supplying an ExpressionTemplatefor that argument, from https://github.com/serilog/serilog-expressions, will allow you to customize the JSON in whatever way you require
(examples are currently thin on the ground, but should be enough in the Serilog.Expressions readme to get you started)
Nicholas Blumhardt
@nblumhardt
@brentarias thanks for the follow-up; it's interesting to explore. It's unlikely we'd make this change, however - there's a very high bar for any changes in how message templates are interpreted. Keeping them as simple and stable as possible is a major goal :-)
if you were keen to implement it in your own app, you could do it in two parts
  1. create some marker type class FromContext { }
  1. Destructure.AsScalar<FromContext>()
  1. create class RemoveFromContextEnricher: ILogEventEnricher that removes any property with a scalar value of type FromContext
  1. Enrich.With<RemoveFromContextEnricher> as the first enricher
  1. log.Information("{Alpha} bit of {Bravo} before {Charlie}", "A", new FromContext(), "details");
I think that will do it; there may be other ways to make it work :-)
Brent Arias
@brentarias
@nblumhardt Hey! I really appreciate you sharing this!
What got me started down this path is that I had taken the time to integrate Serilog with SimpleInjector, using this solution so that SimpleInjector could ensure a Serilog context was established as a "unit of work" for each CQRS command I process. The intent is that any plugin in my plugin-architecture will create log entries that already have the name of the plugin mentioned in each log entry (and available as one of the properties). I got it all working, but discovered that simply having the "ForContext" set correctly for each plugin...didn't mean that I could cleanly integrate that into the text of the log entries.
Thomas Ardal
@ThomasArdal
@nblumhardt Thank you so much, Nicholas. Worked like a charm 👍 BTW, what do you think about sink developers like us taking the build system in another direction? We use GitHub Actions to build everything open source now, why entering the build system in our sink feels like entering another world. I can see advantages in all sinks using the same overall tech stack and scripts, though. What do you think?
Warren Buckley
@warrenbuckley

@nblumhardt are you able to offer advice on porting from Serilog.Filters.Expressions to Serilog.Expressions for the RAW API as I noticed the former is now deprecated.

https://github.com/warrenbuckley/Compact-Log-Format-Viewer/blob/dev/LogViewer.Server/Parser/LogParser.cs#L139-L143

Gerard
@1304654_gitlab
Anyone knows how can I get ("Microsoft.Data.SqlClient.EventSource") events in order to log sql command
through serilog?
I was try but no events comes from.
 .MinimumLevel.Override("Microsoft.Data.SqlClient.EventSource", LogEventLevel.Verbose)
Nicholas Blumhardt
@nblumhardt
@ThomasArdal might be something to consider if/when we start splitting sinks out of the serilog org :+1:
@warrenbuckley I think this is the method you want:
have been giving some thought lately to the names of built-in props - @l vs @Level etc. - would you use a hook point to switch back to the earlier names, if we add one, or do you prefer the shorter ones
?
Thomas Ardal
@ThomasArdal
@nblumhardt If we end up moving the sink to our organization (hadn't heard that was on the table), I'm pretty sure we want to move to GitHub Actions then. The important thing around moving sinks out of the Serilog org is that we would still have a NuGet API key to be able to publish this with a Serilog.Sinks.* prefix on NuGet 👍 I would definitely prefer having more control over the repository.
Nicholas Blumhardt
@nblumhardt
:+1:
advapiIT
@advapiIT
Hello to everybody, I've used serilog to log to seq/ file in those years...now I need to send an email when a specific exception occurs?
I need that when LeadInsertUpdateException occurs
an email is sent to a particular address
Nicholas Blumhardt
@nblumhardt
@advapiIT Serilog.Expressions with Serilog.Sinks.Email and WriteTo.Conditional("@x like '%LeadInsertUpdateException%'", wt => wt.Email(...)) should do the trick
meng
@weianmeng
how remove serilog "ActionName"、"ActionId" Properties
Ruben Bartelink
@bartelink
@weianmeng you should be able to implement an Enricher that does a .RemovePropertyIfExists - best to ask a question on Stack OVerflow with some examples of what you are doing and how you have it configured etcv
6th
@Shusty-6th
How can I use Enrich property with structured data logging?
var sensorInput = new { Latitude = 25, Longitude = 134 };
Log.Information(" Processing {@SensorInput} for {ProcessName}", sensorInput);

gives me: System.IndexOutOfRangeException: Index was outside the bounds of the array.  at Microsoft.Extensions.Logging.LogValuesFormatter.GetValue(Object[] values, Int32 index)
Log.Information(" Processing {@SensorInput}", sensorInput);
and
Log.Information(" Processing for {ProcessName}");

Works good.
Peter Morris
@mrpmorris
Hi all. I am just playing with Serilog and ELK and really enjoying it :)

I have an odd problem though. In an AspNetCore app the following code in CreateHostBuilder appears in Kibana
Log.Information("Starting app");

But the following code in a method on my controller does not
Log.Information("Requested data");

Does anyone have any idea why?

Peter Morris
@mrpmorris
Peter Morris
@mrpmorris
Solved
Peter Morris
@mrpmorris
Any ideas how I can achieve my goal to add ServiceBus.Message.CorrelationId to my logs automatically using Enrich.With?
https://stackoverflow.com/questions/65526026/how-can-i-enrich-serilog-with-servicebus-message-correlationid
Peter Morris
@mrpmorris
varun kumar
@varunkumarmnnit
Hello all I am trying to config serilog in my .netcore application like wheveer i restart my application it should create a new log file and the previous file should be zipped .Currently whever i stop and retartd my service it logs in the same file
what would be the simplest way to do this
Endy Tjahjono
@ndc
In ETW there is a concept of publish subscribe where if there is no listener to an event then the logging code has almost no performance effect on the application. The listener can be separate from the application too. From my quick read Serilog doesn't have the same concept, there is an event processor integrated into the application that will send the event to sinks. Am I correct?
Ruben Bartelink
@bartelink
@varunkumarmnnit I'd say this is not a common ask, nor necessarily a good idea - if you compress the file folder you can achieve similar compression. I'd be more concerned about having logs in a central location etc - i.e. the log files for me are just a temporary landing zone on the way to being forwarded to a log store etc. Finally, I'd say the best place to ask things like this is StackOverflow.com - there's a much higher level of traffic, and anyone that's going to have time to help you here will also be looking at questions tagged serilog over there
varun kumar
@varunkumarmnnit
Thanks for all the comments I guess I am more concerned towarrs finding the way for logging in a new file whever the service starts .Is this possible via some serilog config or some other way
Peter Morris
@mrpmorris
My windows installation of ELK has stopped showing logs. They just aren't appearing any more. Can anyone help me with some trouble shooting?
Peter Morris
@mrpmorris
I uninstalled, and installed a docker image instead :)
Kim Jones
@klickyfan
Hi there. I need to log the json of some objects such that the json can be copied and used as input to an api. But I need it to be proper json, and specifically what I would get if I used Newtonsoft.Json.JsonConvert.SerializeObject. Serializing this way takes into account Newtonsoft attributes on property names like JsonProperty (which you can use to change the property's name) and JsonIgnore. (which you can use to omit the property from the serialized string). Right now I log this way (below) to achieve this, but I would prefer to make some sort of serilog extension instead. I was thinking maybe I could do it with a DestructuringPolicy? Anyway I'd appreciate any advice.
_logger.LogInformation($"{nameof(my Object)}:{Newtonsoft.Json.JsonConvert.SerializeObject(myObject)}");
Kim Jones
@klickyfan
In a perfect world I would love to be able to just use a different destructuring token, say "#" to indicate I want the "myObject" to be serialized this way. So I could choose "@" or "#" as needed. But I would settle for having this sort of serialization be the default for a sink.
Jakob Reesalu
@jensengbg-jakob-reesalu
Hey people! I'm using the RequestLogging middleware and it logs HTTP requests in my API controller, now, I'm logging a warning if the response is NoContent but in the logs this warning shows up BEFORE the HTTP request. Is there a way to solve this?
It looks like this but I which it'd be the reverse:
01/19/2021 09:17:45 WARNING: Returning No Content; no IDs in database [...]
01/19/2021 09:17:45 HTTP GET api/[...]/SubscriberIds responded 204 in 54.0734 ms [...]