Last active
June 3, 2023 02:03
-
-
Save jhlee8804/b10c13d2d6aa2b1b146eddcebdc2c392 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" | |
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" | |
autoReload="true" | |
throwExceptions="false" | |
internalLogLevel="Off" internalLogFile="logs/nlog-internal.log"> | |
<!-- cf. https://github.com/NLog/NLog/wiki/Layout-Renderers --> | |
<variable name="default_layout" | |
value="${time} [${logger}(L\:${callsite-linenumber})] ${uppercase:${level}} (TID\:${threadid}) ${message}${onexception:${newline}${exception:format=ToString}}" /> | |
<!-- | |
usage) | |
MappedDiagnosticsContext.Set("userid", UserId) // thread localized | |
--> | |
<variable name="default_layout" | |
value="${time} [${logger}(L\:${callsite-linenumber})] ${uppercase:${level}} (TID\:${threadid}) ${message}${onexception:${newline}${exception:format=ToString}}" /> | |
<variable name="default_layout_with_user" | |
value="${time} [${logger}(L\:${callsite-linenumber})] ${uppercase:${level}} (TID\:${threadid}, UID\:${mdlc:item=UserID}) ${message}${onexception:${newline}${exception:format=ToString}}" /> | |
<targets> | |
<!-- cf. https://github.com/NLog/NLog/wiki/Console-target --> | |
<target xsi:type="Console" | |
name="console" | |
layout="${when:when=length('${mdlc:item=UserID}') > 0:inner=${default_layout_with_user}:else=${default_layout}}" /> | |
</targets> | |
<rules> | |
<logger name="*" minlevel="Debug" writeTo="console" /> | |
</rules> | |
</nlog> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" | |
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" | |
autoReload="true" | |
throwExceptions="false" | |
internalLogLevel="Off" internalLogFile="logs/nlog-internal.log"> | |
<!-- cf. https://github.com/NLog/NLog/wiki/Layout-Renderers --> | |
<variable name="default_layout" | |
value="${time} [${logger}(L\:${callsite-linenumber})] ${uppercase:${level}} (TID\:${threadid}) ${message}${onexception:${newline}${exception:format=ToString}}" /> | |
<targets> | |
<!-- cf. https://github.com/NLog/NLog/wiki/Console-target --> | |
<target xsi:type="Console" | |
name="console" | |
layout="${default_layout}" /> | |
<!-- cf. https://github.com/NLog/NLog/wiki/File-target --> | |
<target xsi:type="File" | |
name="file" | |
layout="${default_layout}" | |
fileName="logs/${shortdate}/MyApp.log" | |
archiveFileName="logs/archive/${shortdate}/MyApp.log" | |
archiveEvery="Day" | |
maxArchiveFiles="30" | |
encoding="UTF-8" /> | |
<!-- cf. https://github.com/NLog/NLog/wiki/Eventlog-target --> | |
<target xsi:type="EventLog" | |
name="eventlog" | |
layout="${default_layout}" | |
source="MyApp" /> | |
</targets> | |
<rules> | |
<logger name="*" minlevel="Debug" writeTo="console" /> | |
<logger name="*" minlevel="Debug" writeTo="file" /> | |
<logger name="*" minlevel="Info" writeTo="eventlog" /> | |
</rules> | |
</nlog> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment