0
votes

I am using SEQ, file and JSON as a Serilog sinks

        Log.Logger = new LoggerConfiguration()
            .Enrich.With(new ThreadIdEnricher())
            //.Enrich.FromLogContext()
            .WriteTo.RollingFile(@"C:\QRT\Logs\QRT-LOG.txt", LogEventLevel.Information)
            .WriteTo.Seq("http://localhost:5341")
            .WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Information)
            .WriteTo.File(new CompactJsonFormatter(), "C:/QRT/Logs/log.clef")
            .CreateLogger();

SEQ is for me because it looks like it would be really useful. JSON I may do away with... I was attempting to write a file that I could import into Access. The point is that I need my non-developer friend to be able to see the logs and Access is a tool I believe he can use to easily filter on items such as Customer ID etc. I have not been able to find much documentation on the Serilog sinks other than their names. Can someone either suggest a mechanism to sink to something that can be imported to Access or another sink that a user-friendly tool can ready?

I am currently using NLog and GamutLogViewer which is awesome because it can color entries based on regular expressions!

Any suggestions would be most welcome. The idea is my friend is not looking at the logs to debug. He will be looking at the "Information" contained in the logs.

This is using C# on a console app in Windows. Thanks -Ed

1

1 Answers

2
votes

Serilog has a sink called Serilog.Sinks.NLog which adapts Serilog to write events through your existing NLog infrastructure, which means you can effectively use Serilog throughout your app, but output log files in the NLog format, which would be readable by the GamutLogViewer (or YALV! as an alternative).

Another approach I can think of is to use the sink Serilog.Sinks.MSSqlServer where you write your logs to a SQL Server table (could even be a SQL Server Express instance on the user's machine, if you don't want/have a shared SQL Server) and then use Microsoft Access to query these logs via linked tables in Access.

Ultimately, you could develop your own sink that writes directly to a .csv file or even directly to an Access .accdb file, for example. Developing Sinks for Serilog is super easy and there are tons of examples you can use as a base for your custom sink.