Skip to content

Commit c1e036a

Browse files
authored
Include scope properties (#210)
Signed-off-by: Victor Chang <[email protected]>
1 parent 9068fc7 commit c1e036a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/InformaticsGateway/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ internal static IHostBuilder CreateHostBuilder(string[] args) =>
189189

190190
private static NLog.Logger ConfigureNLog(string assemblyVersionNumber)
191191
{
192-
LayoutRenderer.Register("servicename", logEvent => Assembly.GetEntryAssembly()?.GetName().Name);
192+
LayoutRenderer.Register("servicename", logEvent => typeof(Program).Namespace);
193193
LayoutRenderer.Register("serviceversion", logEvent => assemblyVersionNumber);
194194
LayoutRenderer.Register("machinename", logEvent => Environment.MachineName);
195195

src/InformaticsGateway/nlog.config

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<!--
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
3+
<!--
24
Copyright 2022 MONAI Consortium
35
46
Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +16,6 @@ See the License for the specific language governing permissions and
1416
limitations under the License.
1517
-->
1618

17-
<?xml version="1.0" encoding="utf-8" ?>
1819
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
1920
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2021
autoReload="true"
@@ -47,7 +48,7 @@ limitations under the License.
4748
<target xsi:type="ColoredConsole" name="lifetimeConsole" layout="${longdate}|${event-properties:item=EventId:whenEmpty=0}|${uppercase:${level}}|${logger}|${scopenested}|${message} ${exception:format=tostring}" />
4849

4950
<target name="logstash" xsi:type="Network" address="${environment:LOGSTASH_URL}" newLine="true">
50-
<layout xsi:type="JsonLayout" includeAllProperties="true" >
51+
<layout xsi:type="JsonLayout" IncludeEventProperties="true" IncludeScopeProperties="true">
5152
<attribute name="Tag" layout="${environment:ENVIRONMENT_NAME}" />
5253
<attribute name="ServiceName" layout="${servicename}" />
5354
<attribute name="ServiceVersion" layout="${serviceversion}" />

0 commit comments

Comments
 (0)