Questions tagged [serilog-sinks-file]

86 questions
0
votes
0 answers

serilog shared file with retainedFileCountLimit

I have very big solution that use ILogger with serilog for each class, all of them write logs to same file with shared : true. the problem is retainedFileCountLimit doesn’t work for me because everyone count for himself, is there any option to…
0
votes
0 answers

Serilog sink file retainedFileCountLimit with minimum level to error

I am trying to set a minimum level while creating a logger, as reported below: new LoggerConfiguration() .MinimumLevel.Error() .Enrich.FromLogContext() .WriteTo.Async(a =\> a.File(this.logFile, rollingInterval: RollingInterval.Day,…
YellowBlue
  • 651
  • 1
  • 5
  • 5
0
votes
2 answers

Files not being created in the right directory (SeriLog)

I am trying to integrate SeriLog into a project so that I can utilize structured logging. I am trying to put the files at a given path but the log files are not being made in the path I am giving. Instead they are being made in a different…
0
votes
0 answers

Use Serilog in a solution with multiple projects

I have a solution with multiple projects. And I want to set Logger in SDK/common class library and use serilog logger in other projects. Each project generates log files with different settings. The question is: Since the IConfiguration passed to…
benjitino
  • 1
  • 1
0
votes
0 answers

I am using app.config appsetting to write configuration. How will we use Header in file sink using app.config

Using code i am able to add header in file log: WriteTo.File("logheadertest123.dll", hooks: new Serilog.Sinks.File.Header.HeaderWriter(headerFactory)) We should be able to Add Header in Files using app.config How can i achieve this in…
0
votes
0 answers

Writing logs to a file by directories grouped by date. How can I tweak the Serilog config file to achieve this?

project on ASP NET CORE WEB API. dot net version: 6 I decided to use Serilog for logging and I want the logs to be written to a file and also to have the config read from the Json file Here is what I have: { "Name": "Logger", "Args": { …
0
votes
0 answers

Keep Track of Rolling out of a Log file using Serilog

I am using the Serilog for Logging and I have configured it roll out every day, but I want to add a specific log line as a last line of every log file for which I have to keep track when the file is rolling out and new file is created. Any one have…
0
votes
0 answers

Can't get Grpc-net client to log to Serilog file

No log file is created. What's wrong with this code? .Net Framework 4.8. var log = new LoggerConfiguration() .WriteTo.File(@"d:\temp\mdlogfile.txt", rollingInterval: RollingInterval.Day) .CreateLogger(); //log.Information("Here I…
Elroy Flynn
  • 3,032
  • 1
  • 24
  • 33
0
votes
0 answers

Serilog not logging in .net core 6 upgraded from 3.1

i upgraded my .net core 3.1 api to .net 6. i use console and file sinks of serilog but my custom logs from my controller do not get to the log sinks. other logs from the application pipeline get to the file. all logs worked in version 3.1 and i have…
0
votes
0 answers

How to keep user infos in log using Serilog

I'm trying to show request and response in logs using Serilog in .Net Core MVC 6. But also I need to show the user's informations. How can I show it I've never used logging before? Program.cs var logger = new LoggerConfiguration() …
user17847724
0
votes
1 answer

Serilog file sink: Log not written if current user has only write-permission to file

My applications are only used within our company and I have one common log file on a shared drive. I want to log each use of my desktop applications for statistics and also log errors thrown. Also the users should not be able to open the log files…
Tom667
  • 95
  • 1
  • 10
0
votes
1 answer

.Net Core 3.1 Asynchronous File Logging

I have a use case where I need to log data to file Asynchronously which I do not see it possible with Microsoft.Extensions.Logging so need your help to figure out the best solution Use Seri ILogger interface, which according to this github doc does…
Mo Haidar
  • 3,748
  • 6
  • 37
  • 76
0
votes
0 answers

Creating a logger with 2 subloggers with serilog

I'm quite new to C#, Json and Serilog for that. I just started a new gig and my first task is to create a logging function for the application using Serilog. What is asked for: A logger that is always active and follows log levels from information…
0
votes
1 answer

Is there any way to override code written loggers from json configuration in Serilog

I have this code written: return Host.CreateDefaultBuilder() .UseSerilog((context, services, configuration) => configuration .MinimumLevel.Verbose() .ReadFrom.Configuration(_configuration) …
0
votes
1 answer

WriteTo.File not working in .net core 3.1 console application

I have a console application in .net core 3.1 and i configured serilog for logging to file purpose. The WriteTo.Console working but WriteTo.File not working (without any error). I installed this version for Serilog (NuGet): Serilog:…