BewareMyPower opened a new pull request #12372:
URL: https://github.com/apache/pulsar/pull/12372


   Fixes #12325
   
   ### Motivation
   
   C++ client uses one logger per thread, but if the logger of a thread has 
been initialized, even if the logger factory was changed, this logger would 
still keep not changed.
   
   When a `AuthOauth2` object is created, it calls 
`ClientCredentialFlow::initialize`, which calls `LOG_DEBUG` to try logging 
debug level logs. At this moment, the logger of the current thread is created 
and won't change after the custom logger factory is set in `ClientImpl`'s 
constructor. Then the custom logger won't work for that thread.
   
   ### Modifications
   
   To avoid creating the logger in advance to `ClientImpl`'s constructor, this 
PR delays `ClientCredentialFlow::initialize` to the first time 
`ClientCredentialFlow::authenticate` is called. Use `std::call_once` to ensure 
`initialize` is only called once. 
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change is a trivial rework / code cleanup without any test coverage.


-- 
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]


Reply via email to