Closed simonpbond closed 7 years ago
Hi Simon, Thanks for posting your question. I'm excited about the upcoming SignalR release as well.
I think this could be a good use case for the Serilog.Filters.Expressions library. Nicholas Blumhardt wrote a great article here introducing the library.
What I'm not sure of, that I'll need your help with, is the property key names in the "Failed disposing connection" log entry you get from SignalR. So, I'm not sure if it'd be better to filter on the resulting message or on a property which is likely faster.
Once including Serilog.Filters.Expressions
, this may get you part of the way there:
var expr = "@Level = 'Error' and Contains(@Message, 'Failed disposing connection')";
Log.Logger = new LoggerConfiguration()
.Enrich.WithProperty("AppId", 10)
.Filter.ByExcluding(expr)
.WriteTo.LiterateConsole()
.CreateLogger();
Thanks for taking the time to help me out, It looks like the SignalR team are very close to fixing up that error, but will give it a try out of interest & learning :)
Thanks again!
Hello,
I'm wondering if it is possible to hide a specific error from being logged.
I'm using Microsoft's preview release of SignalR core, which currently logs an error on every disconnect. This is a known bug in this preview release, and does not affect the actual functionality of SignalR.
The error message I want to ignore will always contain "Failed disposing connection."
Is there anyway to ignore a specific message based on a string I provide?
Thanks in advance -Simon