Skip to content

Instantly share code, notes, and snippets.

@ithomas51
Last active October 14, 2024 21:26
Show Gist options
  • Save ithomas51/f6b4a00193d7a23943e26025f5fc97c4 to your computer and use it in GitHub Desktop.
Save ithomas51/f6b4a00193d7a23943e26025f5fc97c4 to your computer and use it in GitHub Desktop.
serilog configuration file
{
"Serilog": {
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.File",
"Serilog.Sinks.Async"
],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.Hosting": "Information",
"Microsoft.EntityFrameworkCore": "Warning",
"Microsoft.EntityFrameworkCore.Database.Command": "Warning"
}
},
"WriteTo:Console": {
"Name": "Console",
"Args": {
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] >>> {Message} -- {RequestId}{NewLine}{Exception}",
"formatter": "Serilog.Formatting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact"
},
"Enrich": [
"FromLogContext",
"WithMachineName",
"WithProcessId",
"WithThreadId"
]
},
"WriteTo:Async": {
"Name": "Async",
"Args": {
"configure": [
{
"Name": "File",
"Args": {
"path": "/Logs/ConStrValidation-.txt",
"rollingInterval": "Day",
"rollOnFileSizeLimit": true,
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Properties:j} {NewLine} >>> {Message:lj} {NewLine}{Exception}"
}
}
]
},
"Enrich": [
"FromLogContext",
"WithMachineName",
"WithProcessId",
"WithThreadId"
]
}
}
}
@ithomas51
Copy link
Author

TODO:

  • ADD SQLSERVER
  • CHANGE LOG LOCATION
{
 "path": "/Logs/ConStrValidation-.txt", 
}
// to 
{
 "path": "Logs/ConStrValidation-.txt",    
}      

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment