I want to configure Log4cplus appender, using configuration file, to log messages that include parameters from my application (For example: logging the name of the current function that call the log4cplus logger).
I know that Log4cplus has the patternLayout property that uses conversion patterns to log messages. But I can not see a way to integrate my own string inside the conversion pattern (there is nothing like %s in C that can take any generic string). so, what I would like to know is:
Is there actually a away to integrate a generic string (not literal text) into a Log4Cplus patternLayout?
You could configure patternLayout directly from code:
This will give you some freedom in defining generic string in the pattern layout.
Specifically for function name, according to log4cplus API documentation, you could also use
%M
: