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

Structured logging behaviour in console #1837

Merged
merged 1 commit into from
Jan 28, 2019
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
19 changes: 0 additions & 19 deletions src/EventStore.Common/Log/log.config
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@
</target>

<target name="plainConsoleLog" xsi:type="Console" layout="${ConsoleLayout}"/>
<target name="plainConsoleLogStructured" xsi:type="Console">
<layout xsi:type="JsonLayout">
<attribute name="Date" layout="${date:universalTime=true:format=yyyy\-MM\-ddTHH\:mm\:ss\.ffffffZ}" />
<attribute name="Message" layout="${message:raw=true}" />
<attribute name="Exception" layout="${exception:format=@}" encode="false"/>
<attribute name="EventProperties" encode="false" >
<layout type='JsonLayout' includeAllProperties="true"/>
</attribute>
</layout>
</target>

<target name="statsFileLog" xsi:type="File" fileName="${LogFileNameBase}-stats.csv" layout="${message}" keepFileOpen="true" openFileCacheTimeout="30"/>
<target name="statsFileLogStructured" xsi:type="File" fileName="${LogFileNameBase}-stats.json" layout="${message}" keepFileOpen="true" openFileCacheTimeout="30"/>
Expand Down Expand Up @@ -90,15 +80,6 @@
</logger>

<logger name="*" minlevel="Trace" writeTo="plainConsoleLog">
<filters>
<when condition="is-structured()" action="Ignore"/>
</filters>
</logger>

<logger name="*" minlevel="Trace" writeTo="plainConsoleLogStructured">
<filters>
<when condition="is-structured()==false" action="Ignore"/>
</filters>
</logger>
</rules>
</nlog>
7 changes: 6 additions & 1 deletion src/EventStore.Core/ProgramBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,15 @@ private void Init(TOptions options)
Log.Info("{description,-25} {osRuntimeVersion} ({architecture}-bit)", "RUNTIME:", OS.GetRuntimeVersion(), Marshal.SizeOf(typeof(IntPtr)) * 8);
Log.Info("{description,-25} {maxGeneration}", "GC:", GC.MaxGeneration == 0 ? "NON-GENERATION (PROBABLY BOEHM)" : string.Format("{0} GENERATIONS", GC.MaxGeneration + 1));
Log.Info("{description,-25} {logsDirectory}", "LOGS:", LogManager.LogsDirectory);



if(!structuredLog)
Log.Info("{esOptions}", EventStoreOptions.DumpOptions());
else
else{
Console.WriteLine(EventStoreOptions.DumpOptions());
Log.Info("{@esOptions}", EventStoreOptions.DumpOptionsStructured());
}

if (options.WhatIf)
Application.Exit(ExitCode.Success, "WhatIf option specified");
Expand Down