I have the following NLog filter (logger outputs to the DB):
<logger name="*" minlevel="Error" writeTo="Database" >
<filters>
<when condition="${event-properties:item=LogToDatabase} == false" action="Ignore"/>
</filters>
</logger>
And that is how I call NLog:
Log.Error().Message("test").Property("LogToDatabase", false).Write();
The config seems to be not working with the bool values, however the only way I have managed to make it work is using strings in the config like this:
<when condition="'${event-properties:item=LogToDatabase}' == 'False'" action="Ignore"/>
Then calling NLog with a string Property:
Log.Error().Message("test").Property("LogToDatabase", false.ToString()).Write();
Is there a way to have a boolean check in the config?