Skip to content
Snippets Groups Projects

Fix: Improve logging (coscine/issues#2568)

Merged Benedikt Heinrichs requested to merge Issue/2568-betterLogging into dev
1 file
+ 46
16
Compare changes
  • Side-by-side
  • Inline
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
throwExceptions="true"
throwConfigExceptions="true"
throwExceptions="false"
internalLogFile="Logs/internal-nlog.txt"
internalLogLevel="Trace">
<targets>
<!-- Write logs to File -->
<target xsi:type="File" name="fileLog" fileName="C:/coscine/logs/${assembly-name}/${assembly-version}/log-${shortdate}.log" >
<layout xsi:type="CompoundLayout">
<layout xsi:type="JsonLayout" EscapeForwardSlash="true">
<attribute layout="${longdate}" name="Timestamp"/>
<attribute layout="${level:upperCase=true}" name="Level"/>
<attribute layout="${message}" name="Message"/>
<attribute layout="${exception:format=tostring,StackTrace}" name="Exception"/>
<attribute layout="${ndlc}" name="Context"/>
<attribute layout="${event-properties:item=Metric}" name="Alarm" encode="false"/>
<attribute name="EventProperties" encode="false" >
<layout xsi:type='JsonLayout' includeAllProperties="true" maxRecursionLimit="2"/>
</attribute>
<target xsi:type="FallbackGroup"
name="fileGroup">
<target
xsi:type="File"
name="fileLogD"
fileName="D:/coscine/logs/${assembly-name}/${assembly-version}/log-${shortdate}.log"
maxArchiveFiles="7"
>
<layout xsi:type="CompoundLayout">
<layout xsi:type="JsonLayout" EscapeForwardSlash="true">
<attribute layout="${longdate}" name="Timestamp"/>
<attribute layout="${level:upperCase=true}" name="Level"/>
<attribute layout="${message}" name="Message"/>
<attribute layout="${exception:format=tostring,StackTrace}" name="Exception"/>
<attribute layout="${ndlc}" name="Context"/>
<attribute layout="${event-properties:item=Metric}" name="Alarm" encode="false"/>
<attribute name="EventProperties" encode="false" >
<layout xsi:type='JsonLayout' includeAllProperties="true" maxRecursionLimit="2"/>
</attribute>
</layout>
<layout xsi:type='SimpleLayout' text="," />
</layout>
<layout xsi:type='SimpleLayout' text="," />
</layout>
</target>
<target
xsi:type="File"
name="fileLogC"
fileName="C:/coscine/logs/${assembly-name}/${assembly-version}/log-${shortdate}.log"
maxArchiveFiles="7"
>
<layout xsi:type="CompoundLayout">
<layout xsi:type="JsonLayout" EscapeForwardSlash="true">
<attribute layout="${longdate}" name="Timestamp"/>
<attribute layout="${level:upperCase=true}" name="Level"/>
<attribute layout="${message}" name="Message"/>
<attribute layout="${exception:format=tostring,StackTrace}" name="Exception"/>
<attribute layout="${ndlc}" name="Context"/>
<attribute layout="${event-properties:item=Metric}" name="Alarm" encode="false"/>
<attribute name="EventProperties" encode="false" >
<layout xsi:type='JsonLayout' includeAllProperties="true" maxRecursionLimit="2"/>
</attribute>
</layout>
<layout xsi:type='SimpleLayout' text="," />
</layout>
</target>
</target>
<!-- Write colored logs to Console -->
@@ -37,7 +67,7 @@
<rules>
<!--All logs, including from Microsoft, Level Trace-->
<logger name="*" minlevel="Trace" writeTo="fileLog">
<logger name="*" minlevel="Trace" writeTo="fileGroup">
</logger>
<!--All logs, including from Microsoft, Level Info-->
Loading