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: nic...@msn.com
To: log4net-user@logging.apache.org
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

                                                                                
                                          

Reply via email to