You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by xdzgor <pk...@alpha-solutions.dk> on 2014/11/18 09:23:48 UTC

BUT NOT

Hi - Is it possible to create "exceptions" in logger configurations? Like,
log all classes in a hierarchy except one sub-hierarchy?

For example, I have a lot of classes under a namespace (and sub-namespaces)
starting "Alpha". I'd like to DEBUG log all these classes, except any under
a particular sub-namespace ("Alpha.Import.Core").

Eg something like:

<appender name="one" ...>
  ...
</appender>

<logger name="Alpha" additivity="true" BUT NOT "Alpha.Import.Core">
  <level value="DEBUG" />
  <appender-ref ref="one" />
</logger>

Thanks for any tips,
Peter





--
View this message in context: http://apache-logging.6191.n7.nabble.com/BUT-NOT-tp53010.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

RE: BUT NOT

Posted by Joe <jo...@hotmail.com>.
Apologies, I didn't read your original properly.
Your configuration should work as it stands:, i.e.:

- Alpha.Import.Core and its child loggers will log to "two" only
- Alpha and all its child loggers except Alpha.Import.Core and children will
log to "one" only:

<logger name="Alpha">
  <level value="DEBUG" />
  <appender-ref ref="one" />
</logger>

<logger name="Alpha.Import.Core" additivity="false" >
  <level value="DEBUG" />
  <appender-ref ref="two" />
</logger>



-----Original Message-----
From: xdzgor [mailto:pk@alpha-solutions.dk] 
Sent: 18 November 2014 18:01
To: log4net-user@logging.apache.org
Subject: RE: BUT NOT

Thanks, but additivity is set to false in the "Alpha.Import.Core" logger. If
I also set it to false in the "Alpha" logger, then I don't see any logging
from classes in the namespace "Alpha.Web.UI" or "Alpha.Util". Is this
expected behaviour?



--
View this message in context:
http://apache-logging.6191.n7.nabble.com/BUT-NOT-tp53010p53021.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


RE: BUT NOT

Posted by xdzgor <pk...@alpha-solutions.dk>.
Thanks, but additivity is set to false in the "Alpha.Import.Core" logger. If
I also set it to false in the "Alpha" logger, then I don't see any logging
from classes in the namespace "Alpha.Web.UI" or "Alpha.Util". Is this
expected behaviour?



--
View this message in context: http://apache-logging.6191.n7.nabble.com/BUT-NOT-tp53010p53021.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

RE: BUT NOT

Posted by Joe <jo...@hotmail.com>.
Use additivity="false" in your configuration - look for "Additivity" in the
log4net user manual:
http://logging.apache.org/log4net/release/manual/introduction.html


-----Original Message-----
From: xdzgor [mailto:pk@alpha-solutions.dk] 
Sent: 18 November 2014 10:22
To: log4net-user@logging.apache.org
Subject: Re: BUT NOT

Hi, thanks. What if I want "Alpha.Import.Core" to go to another appender
instead (and all the others to continue to go to appender "one")?

Eg.

<appender name="one" ...>
  ...
</appender>

<appender name="two" ...>
  ...
</appender>

<logger name="Alpha" additivity="true" BUT NOT "Alpha.Import.Core">
  <level value="DEBUG" />
  <appender-ref ref="one" />
</logger>

<logger name="Alpha.Import.Core" additivity="false" >
  <level value="DEBUG" />
  <appender-ref ref="two" />
</logger>




--
View this message in context:
http://apache-logging.6191.n7.nabble.com/BUT-NOT-tp53010p53012.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Re: BUT NOT

Posted by xdzgor <pk...@alpha-solutions.dk>.
Hi, thanks. What if I want "Alpha.Import.Core" to go to another appender
instead (and all the others to continue to go to appender "one")?

Eg.

<appender name="one" ...>
  ...
</appender>

<appender name="two" ...>
  ...
</appender>

<logger name="Alpha" additivity="true" BUT NOT "Alpha.Import.Core">
  <level value="DEBUG" />
  <appender-ref ref="one" />
</logger>

<logger name="Alpha.Import.Core" additivity="false" >
  <level value="DEBUG" />
  <appender-ref ref="two" />
</logger>




--
View this message in context: http://apache-logging.6191.n7.nabble.com/BUT-NOT-tp53010p53012.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Re: BUT NOT

Posted by Ronen Mashal <rm...@magicsoftware.com>.
Yes. Just add a logger named Alpha.Import.Core and set its log level to OFF.
The new logger will inherit from "Alpha" logger:

<logger name="Alpha.Import.Core">
     <level value="OFF"/>
</logger>

On Tue, Nov 18, 2014 at 10:23 AM, xdzgor <pk...@alpha-solutions.dk> wrote:

> Hi - Is it possible to create "exceptions" in logger configurations? Like,
> log all classes in a hierarchy except one sub-hierarchy?
>
> For example, I have a lot of classes under a namespace (and sub-namespaces)
> starting "Alpha". I'd like to DEBUG log all these classes, except any under
> a particular sub-namespace ("Alpha.Import.Core").
>
> Eg something like:
>
> <appender name="one" ...>
>   ...
> </appender>
>
> <logger name="Alpha" additivity="true" BUT NOT "Alpha.Import.Core">
>   <level value="DEBUG" />
>   <appender-ref ref="one" />
> </logger>
>
> Thanks for any tips,
> Peter
>
>
>
>
>
> --
> View this message in context:
> http://apache-logging.6191.n7.nabble.com/BUT-NOT-tp53010.html
> Sent from the Log4net - Users mailing list archive at Nabble.com.
>



-- 



[image: email_sig] <http://www.magicsoftware.com/>
*Ronen Mashal*
*Software Engineer *| Magic Software Enterprises Ltd.

Tel. +972-3-5389215       |       Fax. +972-3-5389333
rmashal@magicsoftware.com | www.magicsoftware.com
<http://www.magicsoftware.com/?utm_source=email> | [image: Facebook]
<http://www.facebook.com/MagicSoftwareEnterprises>[image: Twitter]
<http://twitter.com/#%21/MagicSoftware>[image: Linkedin]
<http://www.linkedin.com/e/gis/130018/09F34B270EFF>[image: YouTube]
<http://www.youtube.com/MagicSoftware>[image: Google+]
<https://plus.google.com/108972177316548101047/posts>[image: Magic Software
Blog] <http://blog.magicsoftware.com/>





DISCLAIMER. Information in this message and its attachments may be
privileged or confidential. It is for the exclusive use of the intended
recipient(s).
If you are not one of the intended recipients, you are hereby informed that
any use, disclosure, distribution, and/or copying of this information is
strictly prohibited.
If you receive this message in error, please notify the sender immediately
and delete all copies of this message. We recommend that you scan your
incoming Emails.
We cannot accept responsibility for any transmitted viruses.