BewareMyPower commented on issue #11845: URL: https://github.com/apache/pulsar/issues/11845#issuecomment-976299261
In C++ client, the logger factory is a global object and can only be initialized only once in the constructor of `Client`. https://github.com/apache/pulsar/blob/9a23dd0eb5557f3d8715437f31f43c9875729d94/pulsar-client-cpp/lib/ClientImpl.cc#L118 https://github.com/apache/pulsar/blob/9a23dd0eb5557f3d8715437f31f43c9875729d94/pulsar-client-cpp/lib/LogUtils.cc#L41-L49 The `LogUtils::setLoggerFactory` method ensures that the logger factory can only be initialized once. I think it's better not to change the current behavior. Each C++ source file uses `DECLARE_LOG_OBJECT` macro to get the **thread local** logger from the factory. https://github.com/apache/pulsar/blob/9a23dd0eb5557f3d8715437f31f43c9875729d94/pulsar-client-cpp/lib/LogUtils.h#L37-L47 Once a logger of a thread is created, even if the global logger factory was reset, the logger won't be affected. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
