Questions tagged [serilog-sinks-file]
86 questions
2
votes
0 answers
Add header to shared rolling files Serilog
I want to use Serilog to write logs generated by different (.NET framework) applications to a common file with headers. It is required that the file be split after a particular byte limit is reached
https://github.com/serilog/serilog-sinks-file…

Bhargavi Madhavan
- 31
- 2
2
votes
0 answers
Serilog: Multi-file output using subloggers and filters
My C# Serilog output should go to two different files: a "regular" output when using 1 set of expressions (WriteOperationalLog), and a JSON output when using another (WriteJsonLog).
As far as I understand it, I think I should be using subloggers to…

EvilBurp
- 21
- 4
2
votes
1 answer
How to use multiple separate logger Serilog file in appsettings.json
I'm trying to configure Serilog two different files using Serilog.Sinks.File to store MVC project And another Serilog.Sinks.MSSqlServer my SQL server table. how can create two different places store error files?
Here is my appsettings.json file…

Mizanur Rahaman
- 411
- 1
- 4
- 10
2
votes
3 answers
Logging to a file in Blazor WASM
I am new to Blazor. I want to log to a file in client side of Blazor WASM. I tried using serilog and serilog.sink.file. But I don't see any logs written to a file. I also don'see any errors. Is it because Blazor WASM operates in the browser sandbox…

karthik vr
- 53
- 1
- 6
2
votes
2 answers
Cannot catch instantiations errors with Serilog and .Net Core 5
I have a .Net Core 5 app with Serilog. I am testing error logging and I have a class that cannot be instantiated because I commented out some services in the DI registration.
This is my Program.cs file:
public static void Main(string[] args)
{
…

sebastian.roibu
- 2,579
- 7
- 37
- 59
1
vote
1 answer
How to prevent logging all of my Entity Framework SQL queries?
I'm using Serilog.Sinks.File and all of my SQL queries are getting logged.
Here is my configuration code:
// Configure Serilog
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(context.Configuration)
…

Jonathan Wood
- 65,341
- 71
- 269
- 466
1
vote
0 answers
Serilog - delete old logs without RollingFile
I need to have a single dedicated log file for each execution of an application - which may occur many times a day.
I set a different name to the log file on each execution by adding timestamp by code.
I cannot use RollingFile because it will create…

Yosi Maurer
- 101
- 2
- 6
1
vote
0 answers
Have Serilog retain files by date (regardless of the number of files)
I am using Serilog in my .Net Core application with the following settings:
"flushToDiskInterval": "00:00:10",
"outputTemplate": "[{Timestamp:MM/dd/yyyy HH:mm:ss:fff}-{Level}]: {Message} - ({SourceContext:l}){NewLine}{Exception}",
"rollingInterval":…

David Jiboye
- 511
- 8
- 19
1
vote
1 answer
Serilog.Sinks.Async is spawning thousands of threads
We are using Serilog file sink and Elastic search sink that both use a Serilog async sink to make sure everything is handled in a background thread.
The last days we had server-wide issues and all applications slowed down.
There was a full user dump…

AardVark71
- 3,928
- 2
- 30
- 50
1
vote
0 answers
How to limit 5 instances of log file creation using Serilog if fileSizeLimitBytes is full
I am using Serilog to create log files in C#/.NET.
Now there is a task to create a new instance of the log file if fileSizeLimitBites is full and the request is to limit it to 5 log files, if the fifth file is full there is no need to create a…

DraganMilovac1993
- 11
- 1
1
vote
1 answer
How do I add the failureSink to elasticsearchSink
I add FileSink as failureSink to ElasticsearchSink from appSettings.json. But "Cannot create instance of type 'Serilog.Core.ILogEventSink' because it is either abstract or an interface." I get an error. How do I fixed it?
"Serilog": {
"Using": […

rdmzcn
- 151
- 1
- 3
- 13
1
vote
1 answer
How to create new log folder for each day using SeriLog
I am using SeriLog in my .Net6 application.
I am trying to create a serilog json configuration that will help me create a new log folder each day.
Then the logs for that day will be created in the corresponding…

Hari Sankar v m
- 163
- 1
- 12
1
vote
0 answers
Serilog Condition writing to file based on global minimum level
I'm trying to log my events in two different files based on the global minimum level set in the logger:
>= Debug to a debug file
>= Information to another file.
I control the minimum level through Dynamic Level and some logic in my app.
In my json…

Sirosimo
- 41
- 2
1
vote
1 answer
Maintaining a (single) stable filename using Serilog File sink
I am logging the data like below :
.WriteTo.File("log.txt", rollOnFileSizeLimit: true,retainedFileCountLimit: 1,
fileSizeLimitBytes: 10)
This creates a file set like this:
log.txt => log_001.txt =>…

tesrer
- 41
- 5
1
vote
0 answers
Serilog Eventid is logged as Json
logger:
ILogger logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration, "Logging")
.Enrich.FromLogContext()
.CreateLogger();
settings:
"Logging": {
"Using": […

Jester
- 3,069
- 5
- 30
- 44