Questions tagged [serilog]

Serilog is a .NET library which provides diagnostic logging to files, the console, and so-on. Consider using this tag along with the .net framework version you are using for extra clarity

Filter by
Sorted by
Tagged with
0 votes
1 answer
28 views

Serilog won't log

I have the following code: var logFilePath = Path.Combine("\"%ProgramData%\\LogFiles\\Platform\\Tool\\\"", "config_tool.log"); // Default logging: Windows event log + ...
brunofer42's user avatar
0 votes
1 answer
29 views

Serilog ElasticSearch Sink custom properties

I'm trying to log to my Elasticsearch instance some data from .NET 6.0 Web Api with Serilog.AspNetCore and Serilog.Sinks.Elasticsearch installed, but I need to use custom properties for example: ...
Pan Michal's user avatar
0 votes
0 answers
16 views

catch exception of serilog sink

Im trying to catch an exception in an asp.net core app which seems to be not directly on application level. Im using serilog with Serilog.AspNetCore and an mqtt-sink: builder.Host.UseSerilog((ctx, ...
pyrogen's user avatar
  • 219
0 votes
1 answer
35 views

Serilog duplicated logs

I have an ASP.NET Core 6 application with a Blazor frontend and I'm using Serilog logger. Currently I have the following configuration for the loggers. As you can see I have three loggers, the first ...
Mauro Alvarez's user avatar
1 vote
0 answers
22 views

Serilog LogEvent results in "{State:l}"?

I've written a custom sink that writes to MySQL for an ASP.NET app. A lot of the messages are appearing as "{State:l}", is this some bug or system log? Am I parsing the actual output ...
ash's user avatar
  • 25
0 votes
1 answer
40 views

Exception Unhandled : Could not load file or assembly 'Serilog.Extensions.Hosting,

When I run my application, this exception is thrown even before the start of debugging. enter image description here System.IO.FileNotFoundException: 'Could not load file or assembly 'Serilog....
Engazzou Azer's user avatar
0 votes
0 answers
17 views

Serilog timestamp missmatch?

I have several .NET services that use Serilog to log data to SEQ. Some of the service are located local so they log to SEQ direcly. The other services can´t reach SEQ so the need to send the LogEvent ...
Banshee's user avatar
  • 15.5k
0 votes
1 answer
23 views

Serilog.Sinks.Oracle - Write Log to Oracle DB with Serilog from C# .Net Framework

I want to write logs to console, file and Oracle DB, from my program (.Net Framework). I was able to write a log to the console and to a file. And I can't write to the DB. My code: { ...
Miriam F.'s user avatar
0 votes
0 answers
81 views

Serilog Memory leak when logging large json

I have default logger configuration var logger = new LoggerConfiguration(); Log.Logger = logger.CreateLogger(); When i send 30Mb json before hitting controller memory increase by 0.5GB _logger....
cargt4's user avatar
  • 43
0 votes
0 answers
33 views

Configure OpenSearch Sink For Serilog

App is crashing with error code 139. Error in Serilog Uri Configuration What is actually Happening. "nodeUris": "http://localhost:9200;" If I remove the above line in appsettings....
danish's user avatar
  • 9
0 votes
1 answer
29 views

Serilog.Enrichers.ClientInfo not logging request headers

I am using Serilog.Enrichers.ClientInfo as Serilog enricher in two dotNet Core 6 web apis. Both apis have the same Serilog packages references, both have identical Serilog configuration. One api is ...
lasjan's user avatar
  • 71
0 votes
0 answers
34 views

C#: What's the different between UseSerilog and assigning Log.Logger?

I want to use my services to perform an async call, generate a parameter to pass to my serilog config before booting up and logging. What is the difference? builder.Host.UseSerilog((context, ...
user avatar
0 votes
1 answer
66 views

How do I separate Serilog Logging output by the class where logging happens?

I am somewhat of an amateur with C# and am working on a .NET Framwork 4.7.2 WPF app where its primary purpose is to allow the user to run code from a class (all of which are kept in a "Scripts&...
NinjaPedroX's user avatar
1 vote
1 answer
71 views

Sentry with generic host and Serilog .NET 7

It is a general question. I literally spent a whole day to figure it out without any success. Is there an example anywhere or can it be done with Sentry or we have to change our log subscription to ...
Yesname's user avatar
  • 45
1 vote
2 answers
111 views

How to log the classPath, methodName and lineNumber with Serilog in C#

I want to print log to file from my system (.NET Framework 4.6.1) I want to print this information: className, methodName, lineNumber from which log entry was Called. I've a Serilog class: ` ...
Miriam F.'s user avatar
0 votes
0 answers
42 views

Serilog is not logging logs from Program.cs

I've updated my .NET 5 application to .NET 6 and encountered a logging issue. In Program.cs Everything above the line var app = builder.Build(); is being logged to the console, while anything below ...
LP13's user avatar
  • 31.3k
0 votes
0 answers
33 views

Does Serilog allow delete of live log file and does it have category name

We have been using NLog and started looking at Serilog. We delete the existing log file when looking at issues in the field. This allows us to minimize what is in a log file in order to understand the ...
dgxhubbard's user avatar
0 votes
1 answer
46 views

How to override, by code, sink properties set by appsettings

My ASP.NET Web Api has appsettings.json specifying Serilog with Serilog.Sinks.Datadog.Logs. This works fine, however, the arg "apiKey" is specified in clear text which breaks our company ...
EuroEager's user avatar
  • 167
2 votes
1 answer
87 views

Serilog: how to write a file with only one level

I've been asked to write log levels Information, Warning and Error in development, but each of them in one separated file, so that I have information.txt containing only Information logs, warning.txt ...
Ikinidae's user avatar
0 votes
0 answers
34 views

Serilog via Elasticsearch

I use serilog to log some data and writes it to console and elasticsearch. ECS supports Geo. Geo can be nested under Client and Host. I use default serilog formatter on official site. So code example ...
Ruslan Kudaybergenov's user avatar
0 votes
1 answer
72 views

AppDependencies table is consuming big amount of GB's because MS.ProcessedByMetricExtractors

I have a .NET application that ingests lot of data into Log Analytics Workspace in Azure, the AppDependencies table is getting more than 1500 records in a 15 minutes frame, it's getting crazy. Most of ...
cammart's user avatar
0 votes
1 answer
97 views

Serilog multiple global loggers

I have a net core 7.0 application with Serilog library for logging. I've defined different log levels. For example, those errors which are fatal, critical will be reported using the slack sink, so the ...
Mauro Alvarez's user avatar
0 votes
0 answers
21 views

Move out put from one console log to another logger that print to file

I have a logger that prints to the console early during application startup. It is set up like so. Log.Logger = new LoggerConfiguration() .WriteTo.Console() .CreateBootstrapLogger();...
LCaraway's user avatar
  • 1,267
0 votes
1 answer
46 views

Serilog : separate logging levels between output window and console

I want to log debug messages only to output window, smth like Debug.WriteLine. Put it simply -- emulate Debug.WriteLine via serilog, so output window should only log debug level, other sinks should ...
Sharov's user avatar
  • 460
1 vote
0 answers
71 views

NET8 Blazor and Serilog

I'm creating a new Blazor Application with NET8. In the main project, the "server" project that contains the Blazor Client, I tried to add Serilog adding at the top of the Program.cs Log....
Enrico's user avatar
  • 3,880
0 votes
1 answer
119 views

.Net Core SonarQube - Make sure the logger's configuration is safe

I have the following code to log errors into application insights. I use SeriLog and enrich it with a property var log = new LoggerConfiguration() .Enrich.FromLogContext() .Enrich.WithProperty("...
techno's user avatar
  • 6,190
0 votes
1 answer
77 views

Serilog Json configuration to API: filters

I need to log to different sinks depending on the value of a property named "EventType". I figured out something in JSON configuration but I can't seem to understand how to translate to code ...
Sirosimo's user avatar
0 votes
1 answer
56 views

The middleware doesn't start automatically, and it doesn't write to Serilog

Here, I'm attaching the code inside the middleware: namespace ... { public class MyMiddleware { private readonly RequestDelegate _next; private readonly ILogger _logger; ...
PippoBest's user avatar
1 vote
1 answer
61 views

Structured Logging Analyzer/Viewer [closed]

I have an ASP.NET Minimal API that uses Serilog as a logging provider. I use for development the normal console logging and for Test/Staging/Prod a combination of stdout and structured file log (JSON ...
bealtis's user avatar
  • 35
0 votes
0 answers
57 views

ASP.NET Core - Serilog isn't save the log into PostgreSQL

I have a problem using Serilog with my ASP.NET Core Web API. I want to save the event of an API into database by separating things with columns. ex.Column | ex.Value = Method | 'GET', URL | Localhost, ...
Nawapol R.'s user avatar
1 vote
0 answers
26 views

How do I add Serilog? Not have just Serilog, but have Serilog ALSO

All of the examples I have found show adding Serilog using: builder.Host.UseSerilog(); The problem is, that then makes Serilog the sole logging provider. There is: builder.Logging.AddSerilog(); but ...
David Thielen's user avatar
5 votes
0 answers
155 views

Trying to use serilog-sinks-azureblobstorage in Blazor

Update: I have a very simple example here. Neither File or AzureBlobStorage work. In addition, if AzureBlobStorage is set, it gets an exception trying to load Blazor_Logger_bug.styles.css - which ...
David Thielen's user avatar
2 votes
0 answers
64 views

Formating ElapsedTime (Timespan) when logging in ElasticSearch with Serilog (C#)

I'm trying to log the elapsed time of a StopWatch with Serilog with an ElasticSearch sink. I managed to print my log properly in console and file with the following command: Log.Information("...
Philippe Balleydier's user avatar
0 votes
1 answer
57 views

Serilog Configuration separate EF logs from Application

I am attempting to have my EF logs in another file from my application logs. Here is my current configuration for Serilog. "Serilog": { "Using": [ "Serilog.Sinks....
JBurlison's user avatar
  • 605
1 vote
0 answers
75 views

serilog specify property names to ignore them during destructuring

There is destructurama.byignoring to ignore by lambdas. Log.Logger = new LoggerConfiguration() .Destructure.ByIgnoringProperties<User>(u => u.Password) // Other logger configurationg ...
ertucode's user avatar
  • 600
1 vote
2 answers
124 views

Serilog retainedFileTimeLimit .net 6 is not working

I was trying to clear log files periodically. So, while searching in serilog.sink.file v5.0.0 I found out a something called retainedFileTimeLimit and I tried it but it didn't work. This is my code -&...
Jawoy's user avatar
  • 53
0 votes
0 answers
60 views

Serilog Save to SQL Server

I have a console application in .NET 6 to log using Serilog to a SQL Server database. Find my code snippet below: Program.cs: using Serilog; using Serilog.Events; using Serilog.Sinks.MSSqlServer; ...
user22677389's user avatar
3 votes
0 answers
47 views

Problems configuring latest Serilog from appSettings.json

I am using Serilog and getting the configuration from the appsettings.json file. I need to update the following code, which worked with an earlier version of the Serilog library but does not work with ...
user1154422's user avatar
2 votes
0 answers
88 views

Azure Function logs once before startup and twice - after

I am migrating my .NET 7 function from isolated to .NET 6 in-process and having some issues with bringing Serilog back to life. With the help of other questions I changed from services.AddLogging(lb =&...
Yehor Androsov's user avatar
0 votes
0 answers
32 views

Can ı put together my request and response logs in one document

This is my logs I am using Serilog, Elasticsearch and kibana for logging. When I send a request, serilog logs 4 different documents for 1 request. I can't see my response and request logs in 1 ...
Serdar Yiğit Yanık's user avatar
1 vote
1 answer
87 views

How do I get arbitrary objects to serialize as JSON in Serilog using ILogger scopes?

I'm creating logs using the normal ILogger logger, and am attempting to output to Serilog. The actual output works, but when I add an arbitrary object through ILogger<T>.BeginScope, it shows up ...
Lee Crabtree's user avatar
  • 1,216
2 votes
1 answer
90 views

Adding extra metadata to a Microsoft "ILogger" LogDebug message?

I have the following message I wish to log: _logger.LogDebug("Finished: DB retrieved OutboundData settings.", new { ElapsedTime = stopwatch.Elapsed }); this is using the Microsoft....
Pure.Krome's user avatar
  • 85.1k
2 votes
2 answers
119 views

Unable to send logs to OpenTelemetry backend (using Serilog in .Net framework 4.8)

I am using Serilog in .Net Framework 4.8 to send logs to OpenTelemetry. I am using Elastic as OpenTelemetry backend . I am able to send traces and but not logs. Please find my below code where it ...
Sunil Kumar P V's user avatar
0 votes
0 answers
101 views

How do I configure Serilog in appsettings.json to create log file in UTF-8-BOM encoding?

The default file encoding that Serilog creates is utf-8 without BOM. How do I configure Serilog in appsettings.json to create log file in UTF-8-BOM encoding? If i add "encoding": "utf-8&...
Moris's user avatar
  • 5
0 votes
0 answers
28 views

Reducing delay between System.Timers.TImer calls [duplicate]

I am storing OHLC data real-time in a CSV file for which I am using a System.Timers.Timer to trigger every 60 seconds. Timer is something like this: System.Timers.Timer timer = new System.Timers.Timer(...
DharuvVerma21's user avatar
1 vote
1 answer
78 views

How can I use Serilog to log the length of content received, execution time, and results of SignalR hub methods?

I want to log certain information in SignalR using Serilog, similar to what is obtained with UseSerilogRequestLogging. I've tried using HubLogFilter to solve my problem, but I'm unable to capture the ...
Fatorin's user avatar
  • 55
0 votes
1 answer
79 views

.Net 6 logging to oracle database using Serilog sink feature

I'm trying to log the information and errors to the oracle database using serilog I see only examples for MS SQL Server. I created this config using that as an example. I don't see any blog or info ...
Subash Subramaniam's user avatar
1 vote
2 answers
40 views

Specify separating character when deconstructing Object with Serilog

When deconstructing complex object with the @ character in Serilog it defaults to using a ":" (colon) as a separating character. I'd like it to be "=" (equal) sign instead. Is this ...
Breakwin's user avatar
0 votes
2 answers
63 views

In my .NET 6 project, I need to process files for different companies and maintain separate logs. How can I achieve this?

I'm using Serilog in my project for logging. Flow Explaination: I will receive a request on api. The request will contain provider value. Using the provider value we will call the respective provider ...
Hardik Dhuri's user avatar
0 votes
1 answer
26 views

Azure Application Insights view log chart. Data included in the log message

Using Azure Application Insights to view the log done by Serilog. I wonder why the parameter is a part of the event string. This causes the graph to use a different color for each time the event is ...
MaxP's user avatar
  • 345

1
2 3 4 5
46