How can I filter logging based on a logged exception's message?
Code looks like this:
try
{
someService.DoSomeWorkflow();
}
catch(Exception e)
{
log.Error("Hey I have an error", e);
}
Config looks like this:
<appender name="EventLogger" type="log4net.Appender.EventLogAppender">
<applicationName value="foo" />
<layout type="log4net.Layout.PatternLayout" value="PID:%P{pid}: %message" />
<filter type="log4net.Filter.StringMatchFilter">
<stringToMatch value="TextInsideTheException" />
</filter>
</appender>
I'm finding that I can filter only on the logged message ("Hey I have an error") but it seemingly ignores the exception's message. Since this is in our production environment I can't make any code changes so I can't change the logged message. Is there some configuration that would specify to also check the exception's message?