This example shows how to extend Log4cxx with a new appender.
public:
NullWriterAppender(){}
void close() override{}
bool requiresLayout() const override {
return false;
}
}
}
void setOption(const LogString& option, const LogString& value) override {
if (helpers::StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("SOMEVALUE"), LOG4CXX_STR("somevalue"))){
}
}
};
}
int main( int argc, char** argv )
{
xml::DOMConfigurator::configure( "example-custom-appender.xml" );
LoggerPtr rootLogger = Logger::getRootLogger();
LoggerPtr nullLogger = Logger::getLogger(
"NullLogger" );
LOG4CXX_INFO( nullLogger,
"This message will be discarded" );
}
Implementation base class for all appenders.
Definition: appenderskeleton.h:41
#define LOG4CXX_INFO(logger, message)
Add a new logging event containing message to attached appender(s) if logger is enabled for INFO even...
Definition: logger.h:2102
Definition: configuration.h:25
std::shared_ptr< Logger > LoggerPtr
Definition: defaultloggerfactory.h:27
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:157
#define IMPLEMENT_LOG4CXX_OBJECT(object)
Definition: object.h:65
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:151
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:42
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:163
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:145