Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include scope properties #210

Merged
merged 1 commit into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/InformaticsGateway/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ internal static IHostBuilder CreateHostBuilder(string[] args) =>

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

Expand Down
7 changes: 4 additions & 3 deletions src/InformaticsGateway/nlog.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<!--
<?xml version="1.0" encoding="utf-8" ?>

<!--
Copyright 2022 MONAI Consortium

Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,7 +16,6 @@ See the License for the specific language governing permissions and
limitations under the License.
-->

<?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"
autoReload="true"
Expand Down Expand Up @@ -47,7 +48,7 @@ limitations under the License.
<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" includeAllProperties="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}" />
Expand Down