It seems another way to solve the same problem I was trying to solve is to
redefine 'Off'. This also worked:
<level>
<name value="Off"/>
<value value="40000"
</level>
I still would like to know how to set the display name of a level via
configuration, if that's possible. It appears it takes the <name> element's
'value' as the display name since I did define a custom level and saw the name
in the log file. However, I read that a level has a name and a display name
and the display name is used for writing to the log.
Thanks,
Nick
From: [email protected]
To: [email protected]
Subject: RE: setting or overriding log levels via configuration?
Date: Thu, 9 Jul 2015 15:30:58 -0400
Was working on this more and decided I would just attempt to add the <level>
element under the <log4net> element and see what happens. Luckily there is a
"debug" attribute on the <log4net> element which gives you an indication of
what log4net is doing so I also turned that on. It seems to work not only
based on the debug log4net statements I saw generated, but the test results
also confirmed it's working. Well let me restate that. What I added was the
following:
<level>
<name value="Warn"/>
<value value="2147483647"/>
</level>
<level>
<name value="Info"/>
<value value="2147483647"/>
</level>
<level>
<name value="Error"/>
<value value="2147483647"/>
</level>
I did this because I wanted to see if I could make it such that Error, Warn and
Info logs could not be turned off. And it appears this accomplishes that.
I still have a question. If I want to add a new level is there a way to
specify the "display name" of that level in configuration?
Thanks,
Nick
From: [email protected]
To: [email protected]
Subject: setting or overriding log levels via configuration?
Date: Wed, 8 Jul 2015 22:29:16 -0400
Hello,
Is there a way to set custom log levels via configuration?
Is there a way to change existing log levels via configuration?
At the end of this post
http://stackoverflow.com/questions/538095/how-do-i-filter-on-a-custom-level-in-log4net
I see someone had said:
"You will need to add
<level>
<name value="AUDIT" />
<value value="35000" />
</level>
in your log4net config section."
which lead me to believe specifying custom log levels in configuration is
possible. However after searching for a while I have seen no other reference
to something similar.
Thanks,
Nick