How do I change the name GlobalLogger or StaticMethodLogger within C++ logs?
A: There is more than one way to do this but only one is recommended.To answer this question completely, a little background on how the ACS logging system in C++ works is needed. Basically all the non-static context logging macros defined within loggingACEMACROS.h are dependent upon a single function or method being available: Logging::Logger::LoggerSmartPtr getLogger(); which ACS has implemented in the logging library already. The name of the Logger object returned by this ACS-implemented function is GlobalLogger. The macros themselves then just make calls to A positive consequence of this is that:
protected: Logging::Logger::LoggerSmartPtr getLogger() { return ::getNamedLogger("whatever name I choose"); } In this case, all we do is use another ACS-provided function to create a Logger with a name of our choice. As for changing the name of the Logger used by static logging macros:
Logging::Logger::LoggerSmartPtr getNamedLogger(const std::string& loggerName) { return ::getNamedLogger("my name and not loggerName"); } |
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.
|