You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/10/14 15:12:25 UTC

[GitHub] [pulsar] BewareMyPower commented on issue #12325: [C++] Custom logger doesn't work when OAuth 2.0 authentication is configured

BewareMyPower commented on issue #12325:
URL: https://github.com/apache/pulsar/issues/12325#issuecomment-943454360


   A more simple comparison.
   
   Example 1:
   
   ```c++
   #include <pulsar/Client.h>
   using namespace pulsar;
   
   int main() {
       const std::string authParams = R"({
       "issuer_url": "https://dev-kt-aa9ne.us.auth0.com"
   })";
   
       Client client("pulsar://localhost:6650", ClientConfiguration()
                                                    .setLogger(new ConsoleLoggerFactory(Logger::LEVEL_DEBUG))
                                                    .setAuth(AuthOauth2::create(authParams)));
       client.close();
   }
   ```
   
   Output 1:
   
   ```
   2021-10-14 23:10:16.856 INFO  [0x11a154e00] ClientImpl:492 | Closing Pulsar client with 0 producers and 0 consumers
   ```
   
   Example 2 (remove the `setAuth` line):
   
   ```c++
   #include <pulsar/Client.h>
   using namespace pulsar;
   
   int main() {
       const std::string authParams = R"({
       "issuer_url": "https://dev-kt-aa9ne.us.auth0.com"
   })";
   
       Client client("pulsar://localhost:6650", ClientConfiguration()
                                                    .setLogger(new ConsoleLoggerFactory(Logger::LEVEL_DEBUG)));
       client.close();
   }
   ```
   
   Output 2:
   
   ```
   2021-10-14 23:11:37.677 DEBUG [0x110646e00] ClientImpl:126 | Using Binary Lookup
   2021-10-14 23:11:37.677 INFO  [0x110646e00] ClientImpl:492 | Closing Pulsar client with 0 producers and 0 consumers
   2021-10-14 23:11:37.677 DEBUG [0x110646e00] ClientImpl:536 | Shutting down producers and consumers for client
   2021-10-14 23:11:37.677 DEBUG [0x110646e00] ClientImpl:578 | ConnectionPool is closed
   2021-10-14 23:11:37.677 DEBUG [0x110646e00] ClientImpl:580 | ioExecutorProvider_ is closed
   2021-10-14 23:11:37.677 DEBUG [0x110646e00] ClientImpl:582 | listenerExecutorProvider_ is closed
   2021-10-14 23:11:37.677 DEBUG [0x110646e00] ClientImpl:584 | partitionListenerExecutorProvider_ is closed
   ```
   
   We can see the custom logger works now without `AuthOauth2::create` call.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org