[prev in list] [next in list] [prev in thread] [next in thread] 

List:       log4cxx-user
Subject:    Re: Using filters
From:       Thorsten_Schöning <tschoening () am-soft ! de>
Date:       2014-10-14 6:22:51
Message-ID: 1489459299.20141014082251 () am-soft ! de
[Download RAW message or body]

Guten Tag Rakesh Sehgal,
am Dienstag, 14. Oktober 2014 um 00:06 schrieben Sie:

> Thanks for your reply. I am using the current HEAD for log4cxx, and just now I found out that
> the stringmatchfilter works with the XML file

What does "works" exactly mean? Did you successfully configure a
stringmatchfilter using your wildcards for a XML configuration?
Because from the code it looks that your wild cards won't work at all,
stringmatchfilter only uses the "find" method of std::basic_string for
a match.

> I do want to use the logger, like in the example above,  
> I want to use some sort of a wildcard that would let me enable logging for all those that
> match that criteria.

I guess that won't work and if you already build your loggers
dynamically you should find another way to deactivate them because
filtering completely rendered log messages just to ignore them looks
like a very ineffecient way.

The interesting question is when do you want to deactivate your
loggers: If it's on runtime by a changed configuration, watched by
filewatchdog, I would try to hook parsing of the configuration file
for a logger statement with your wildcards and search for those only
loggers on my own to set their logging level to OFF.

When your application only configures logging at startup time you only
need to hook the parsing logic for logger names, save all names with
your wildcards and after the whole logging has been set up you can
iterate over all loggers and set their logging level again to OFF.

You might as well try to override StringMatchFilter::decide to not use
plain "find" or have a look at LoggerMatchFilter, which doesn't seem
to support wildcards as well. Seems like there are different ways to
go, but you need to have a more detailled look on that on your own.

It doesn't seem that what you try to achieve is possible without any
coding just by configuration.

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail:Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic