Logging: Improve json logging

This commit is contained in:
Jonathan Jenne
2023-09-01 13:56:37 +02:00
parent 2b80e8fa97
commit e63d1ea557
3 changed files with 17 additions and 7 deletions

View File

@@ -527,13 +527,13 @@ Public Class LogConfig
#Region "Log Targets"
Private Function GetJsonLogTarget(basePath As String) As FileTarget
Dim oJsonLayout = New Layouts.JsonLayout
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("level", "${level}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("message", "${message}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("date", "${shortdate}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("product", "${var:product}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("suffix", "${var:suffix}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("module", "${event-properties:item=ModuleName}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("exception", "${exception:format=Message,StackTrace:innerFormat=Message:maxInnerExceptionLevel=3}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("Level", "${level}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("Message", "${message}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("Time", "${date}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("Product", "${var:product}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("Suffix", "${var:suffix}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("Module", "${event-properties:item=ModuleName}"))
oJsonLayout.Attributes.Add(New Layouts.JsonAttribute("Exception", "${exception:format=@,StackTrace:innerFormat=@:maxInnerExceptionLevel=3}"))
Dim jsonLog As New FileTarget() With {
.FileName = Path.Combine(basePath, FILE_NAME_FORMAT_JSON),