-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure IG log for integration test
Signed-off-by: Victor Chang <vicchang@nvidia.com>
- Loading branch information
Showing
3 changed files
with
95 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
|
||
<!-- | ||
Copyright 2022 MONAI Consortium | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
autoReload="true" | ||
internalLogLevel="Debug" | ||
internalLogFile="${basedir}/logs/internal-nlog.txt"> | ||
|
||
<extensions> | ||
<add assembly="NLog.Web.AspNetCore"/> | ||
<add assembly="NLog.Extensions.Logging"/> | ||
</extensions> | ||
|
||
<variable name="logDir" value="${basedir}/logs/" /> | ||
|
||
<time type="AccurateUTC" /> | ||
|
||
<targets async="true"> | ||
<!-- File Target for all log messages with basic details --> | ||
<target xsi:type="File" name="allfile" fileName="${logDir}/MIG-${shortdate}.log" > | ||
<layout xsi:type="JsonLayout" includeEventProperties="true" includeScopeProperties="true"> | ||
<attribute name="timestamp" layout="${date:format=o}" /> | ||
<attribute name="level" layout="${level:upperCase=true}"/> | ||
<attribute name="logger" layout="${logger}" /> | ||
<attribute name="message" layout="${message:raw=true}" /> | ||
<attribute name="properties" layout="${message:raw=true}" /> | ||
</layout> | ||
</target> | ||
|
||
|
||
<!--Console Target for hosting lifetime messages to improve Docker / Visual Studio startup detection --> | ||
<target xsi:type="ColoredConsole" name="lifetimeConsole" layout="${longdate}|${event-properties:item=EventId:whenEmpty=0}|${uppercase:${level}}|${logger}|${scopenested}|${message} ${exception:format=tostring}" /> | ||
|
||
<target name="logstash" xsi:type="Network" address="${environment:LOGSTASH_URL}" newLine="true"> | ||
<layout xsi:type="JsonLayout" IncludeEventProperties="true" IncludeScopeProperties="true"> | ||
<attribute name="Tag" layout="${environment:ENVIRONMENT_NAME}" /> | ||
<attribute name="ServiceName" layout="${servicename}" /> | ||
<attribute name="ServiceVersion" layout="${serviceversion}" /> | ||
<attribute name="MachineName" layout="${machinename}" /> | ||
<attribute name="CorrelationId" layout="${mdlc:item=correlationId}"/> | ||
<attribute name="LoggerName" layout="${logger}"/> | ||
<attribute name="Level" layout="${level:upperCase=true}"/> | ||
<attribute name="Message" layout="${message}"/> | ||
<attribute name="Exception" layout="${onexception:${literal:text=|}"/> | ||
<attribute name="Exception2" layout="${exception:format=tostring}"/> | ||
</layout> | ||
</target> | ||
|
||
</targets> | ||
|
||
<!-- rules to map from logger name to target --> | ||
<rules> | ||
<!--All logs, including from Microsoft--> | ||
<logger name="*" minlevel="Trace" writeTo="allfile" /> | ||
|
||
<!--Output hosting lifetime messages to console target for faster startup detection --> | ||
<logger name="Microsoft.EntityFrameworkCore" minlevel="Warn" writeTo="lifetimeConsole" final="false" /> | ||
<logger name="Microsoft.Hosting.Lifetime" minlevel="Info" writeTo="lifetimeConsole" final="false" /> | ||
<logger name="Monai.*" minlevel="Debug" writeTo="lifetimeConsole" final="false" /> | ||
|
||
<!--Skip non-critical Microsoft logs and so log only own logs (BlackHole) --> | ||
<logger name="Microsoft.*" maxlevel="Info" final="true" /> | ||
<logger name="System.Net.Http.*" maxlevel="Info" final="true" /> | ||
|
||
<logger name="*" minlevel="Trace" writeTo="logstash" > | ||
<filters FilterDefaultAction="Log"> | ||
<when condition="length('${environment:LOGSTASH_URL}') < 10" action="Ignore" /> | ||
</filters> | ||
</logger> | ||
|
||
</rules> | ||
</nlog> |