Questions tagged [serilog-sinks-file]

86 questions
1
vote
0 answers

Serilog - Preserve current log file name and custom archive names

Currently using: Serilog 2.11.0 Serilog.Sinks.File 5.0.0 Serilog.Sinks.RollingFile 3.3.0 With the following logger configuration: _logger = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.File( …
seanrco
  • 935
  • 5
  • 16
  • 32
1
vote
0 answers

Serilog - How to log messages in ascending order in text file?

Currently, my Serilog implementation logs files in descending order - displays the oldest message at the top and the newest message at the bottom. I would like my implementation to log in ascending order - newest at the top and oldest at the…
Meeth46
  • 61
  • 4
1
vote
1 answer

Serilog not logging

I have the following config public static IServiceCollection ConfigureSiteLogging(this IServiceCollection services) { if (!Directory.Exists(@"D:\inetpub\logs")) { Directory.CreateDirectory(@"D:\inetpub\logs"); } …
Walter Verhoeven
  • 3,867
  • 27
  • 36
1
vote
1 answer

How to configure Serilog settings in Azure Function?

I’m in the process of creating my first production Azure Function and I’m trying to write log information to a local file and then eventually to Blob Storage. The local file is more for development troubleshooting and then ultimately I would like to…
Caverman
  • 3,371
  • 9
  • 59
  • 115
1
vote
1 answer

how to keep only application related logs and remove all other Function related logs

I an using Serilog with Azure Function app and all possible extra logs I set level either with warning or error, var logger = new LoggerConfiguration() .MinimumLevel.Override("Microsoft", LogEventLevel.Warning) …
user584018
  • 10,186
  • 15
  • 74
  • 160
1
vote
1 answer

Is there a way to create a Serilog non rolling File Sink that doesn't include the date stamp in the filename?

I'm a newbie to C#... We're using Serilog to record ILogger log records. For my test cases, I'd like to pass a log filename to Serilog File sink and have it not insert YYYYMMDD into the filename. So far, I have not found a way to get Serilog to not…
Ed Thomas
  • 13
  • 2
1
vote
0 answers

Create log files with Serilog only if their is any logs

I want to write different logs on different log files with Serilog by API request. The problem is when the log file configured within LoggerConfiguration(), they created no matter if their is any logs or not. The problem is that I have many empty…
1
vote
0 answers

Move rolled files to another folder

Is it possible to move old files to some other folder? I have it set up to roll every day and I want to have current log in one folder and older logs from previous days in sub-folder so that it is easier to find the latest file. At the very least I…
Slowmo
  • 11
  • 2
1
vote
1 answer

Serilog Date not being appended to log filename

I have Serilog setup and logging in my application, however the date is not being appended to filename. The log file gets created as Log-.log instead of Log-20220302.log. Relevant code is shown below. The nuget package Serilog.Sinks.File has been…
PixelPaul
  • 2,609
  • 4
  • 39
  • 70
1
vote
0 answers

Serilog ReadFrom.Configuration is not working in .net framework web Api with configuration stored in web.config

I am using serilog in a web api in .net framework with the serilog config added in the Web.Config file as below
Midhun P
  • 126
  • 1
  • 11
1
vote
1 answer

Get Serilog to append its first log file with _001

Is it possible to configure Serilog so that the default log file is appended with _001 and if the file limit is reached, that subsequent files are appended with _002, _003 etc. This is in the context of a ASP.NET Core application.
PaulN
  • 329
  • 2
  • 6
  • 13
1
vote
1 answer

Change Serilog logging file path to a higher level directory

I am trying to change the location of where Serilog files get written to. It will write to a directory at the root of the project or below (example, StructuredLogs/file-here.txt), but any time I attempt to use an env variable or write to an absolute…
1
vote
1 answer

How to get Serilog into Azure Log Stream in Azure Function .NET 3.1

I am able to get the Serilog into console, but after publishing into Azure Functions, the logs message using Serilog.log.information() etc does not appear. I tried writing to a file using file.sink .WriteTo.File( …
chiaDev
  • 389
  • 3
  • 17
1
vote
1 answer

Separate log file for separate thread using serilog

I have a .Net Worker Service app which has multiple threads. I want to log each thread into separate file to make it easier to read the logs. Any ideas to implement this?
1
vote
1 answer

Serilog child classes not logging when using ByIncludingOnly

I am using the following log configuration.. .WriteTo.Logger(lc => lc.Filter.ByIncludingOnly(Matching.FromSource<****.Application.Common.Services.Jobs.JobService>()).WriteTo.File("logs/jobs-.log", rollingInterval: RollingInterval.Day)) I am trying…
Mardo
  • 117
  • 1
  • 9