rm5248 commented on code in PR #511:
URL: https://github.com/apache/logging-log4cxx/pull/511#discussion_r2209095595


##########
src/examples/cpp/MyApp1.cpp:
##########
@@ -1,11 +1,11 @@
-#include <log4cxx/logger.h>
+#include <log4cxx/logmanager.h>
 #include <log4cxx/basicconfigurator.h>
 
-static auto logger = log4cxx::Logger::getLogger("MyApp");

Review Comment:
   is there a particular reason that we should use `LogManager::getLogger` 
instead of `Logger::getLogger`?  IIRC they're effectively the same.



##########
src/examples/cpp/MyApp1.cpp:
##########
@@ -20,5 +20,6 @@ int main(int argc, char **argv) {
        LOG4CXX_INFO(logger, "Entering application.");
        foo();
        LOG4CXX_INFO(logger, "Exiting application.");
+       log4cxx::LogManager::shutdown();

Review Comment:
   How about adding a comment here?  Something along the lines of:
   ```
   While not needed in many cases, calling LogManager::shutdown() guarantees 
that
   all of the resources used by log4cxx are cleaned up and disposed of properly.
   ```
   
   Most simple applications don't need it, but it's probably good practice.  
Did we also change `LogManager::shutdown()` to work properly if there are 
multiple threads logging on exit?
   



-- 
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: notifications-unsubscr...@logging.apache.org

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

Reply via email to