pulsar-client-cpp icon indicating copy to clipboard operation
pulsar-client-cpp copied to clipboard

Custom LoggerFactory for log4cxx

Open izumo27 opened this issue 2 years ago • 2 comments

FileLoggerFactory simply outputs logs to a single file. If users want to rotate log files, they need to implement custom LoggerFactory by themselves. Log4cxxLogger was deleted in #283, but this is useful for users.

So I would like to recover Log4cxxLogger. I would not create specialized methods for Log4cxxLogger as there used to be, but would like to make it one of the options in the same category as ConsoleLoggerFactory and FileLoggerFactory. https://github.com/apache/pulsar-client-cpp/pull/283/files#diff-abb02af9369945477ebc3329b299544ba67e214ac3f36c55b1f9e27f68469abf If we want to avoid embedding it as a build option, we can separate the client and logger packages.

izumo27 avatar Dec 26 '23 02:12 izumo27

It's better not to bind the library with a specific logging framework.

It make sense to me to add back the LoggerFactory for log4cxx. But it's better to add them to a different directory, e.g.

include/pulsar/logging/Log4cxxLogger.h

BTW, I think it should be header-only. Otherwise, we need to bind the log4cxx dependency with pulsar-client-cpp.

BewareMyPower avatar Dec 26 '23 03:12 BewareMyPower

In future, we can add more other logging library integrations like spdlog

BewareMyPower avatar Dec 26 '23 03:12 BewareMyPower