Hi,
I was wondering how can I set on production the log level as per microsoft document (https://docs.abp.io/en/abp/latest/Logging).
I realized that in my local development environment, target = Debug, it shows [DBG] lines in the log (Host\Logs). But, in productions or test environment where I have published and deployed the solution as target = Release, I cannot see those lines.
Also, the log file is just one and it is getting bigger and bigger. Is that possible to split in several files and define a limit size for each file? In Log4Net that is possible, but, reading the microsoft doc I am not sure how to do that.
That is the config that I've added into appsettings.json, but it makes no difference.
2 Answer(s)
-
1
You can check
LoggerConfiguration
under Program.cs and modify as you need. Here is a sample logging modification: <br>Log.Logger = new LoggerConfiguration() #if DEBUG .MinimumLevel.Debug() #else .MinimumLevel.Information() #endif .MinimumLevel.Override("Microsoft", LogEventLevel.Information) .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) .WriteTo.Async(c => c.File("Logs/logs.txt")) .WriteTo.Async(c => c.Console()) .CreateLogger();
-
2
Hi gterdem,
Actually, ABP.IO WASM template is using Serilog to create log files, right? So, why on the documentation it is saying that logs are created based on Microsoft Logger?
Also, the settings are hardcode. As suggestion, it should be changed to read from appsettings.json, which makes more sense.
Here is my customization for logs to read from appsettings.json and also break files based on the file size of 10Mb.