New User Question on Output and Encrichers

154 views
Skip to first unread message

Shawn Anderson

unread,
Jul 10, 2015, 12:46:08 PM7/10/15
to ser...@googlegroups.com
Greetings,

I am a new user of the serilog framework and I am running into an issue that is most like just me missing something basic. 

Here is my configuration statement

Log.Logger = new LoggerConfiguration()
           
.Enrich.WithMachineName()
           
.Enrich.WithProcessId()
           
.WriteTo.ColoredConsole()
           
.WriteTo.RollingFile(logPath)
           
.MinimumLevel.Verbose()
           
.CreateLogger();


Here is a simple log entry

Log.Information("Application Initializing - Startup");

and the odd part is here is the log output

07/09/2015 13:08:37 [Information] Application Initializing - Startup

My question is, my isn't the MachineName and ProcessID being added to the output?
707

Ian Yates

unread,
Jul 11, 2015, 1:32:37 AM7/11/15
to ser...@googlegroups.com
The enriched information will be provided as metadata to your various log sinks.  So if you were logging to Serilog, SQL Server, Mongo, etc then you'd have that extra data available to query on.  See half way down http://getseq.net for an example (it has HttpRequestId, etc as additional data to the main logged message).

If you're just logging to the console then there's nowhere to put that data so you just get the message.

Hope that helps :)

By the way, Nick lets you use a single-user licence of Seq for free - give it a try :)

Shawn Anderson

unread,
Jul 11, 2015, 2:19:47 PM7/11/15
to ser...@googlegroups.com
So from what I can tell I need to override the message template to get the actual information to log -- sound correct?
2591

Shawn Anderson

unread,
Jul 11, 2015, 2:20:59 PM7/11/15
to ser...@googlegroups.com
Seq looks good -- I am just hoping to find something that can be installed easily in to azure (without needing to setup another vm) :)
2597
Reply all
Reply to author
Forward
0 new messages