Log4cplus has the spi::StringMatchFilter filter, which enables a simple matching of a string or sub-string to the log message (event message).
I have gcc version 4.8.5 and what I would like to do is add to the Log4cplus the ability for filtering log messages using regular-expression and not just a simple sub-string (simple strstr search).
I have tried using the std::regex and std::tr1::regex libs, but unfortunately their functions are not fully implemented on gcc 4.8 compilers.
I would be glad to get a direction or an idea of how I can achieve my goal? (I cannot upgrade my gcc, nor use boost libs).
I know one option is to use the PCRE lib by compiling the Log4cplus Makefile with this lib and add the regular-expression functions in the Log4cplus Filter.cxx src code, but I am not sure of how to modify the Log4cplus Makefile to link to the PCRE lib (where and how to add the PCRE lib link).
I would be grateful for any suggestion.
I think this is bit too broad a question.
You do not need to modify log4cplus itself. You can put the filter into your own application code and register the filter with factory registry:
#include <log4cplus/spi/factory.h>
// Into main() or some other convenient place:
log4cplus::spi::FilterFactoryRegistry& filter_reg = log4cplus::spi::getFilterFactoryRegistry();
LOG4CPLUS_REG_PRODUCT (filter_reg, "your::ns::", YourFilterClassNameHereInYourNs, your::ns::,
log4cplus::spi::FilterFactory);