You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2019/12/10 18:46:27 UTC

[GitHub] [hbase] belugabehr commented on a change in pull request #913: HBASE-23381: Improve Logging in HBase Commons Package

belugabehr commented on a change in pull request #913: HBASE-23381: Improve Logging in HBase Commons Package
URL: https://github.com/apache/hbase/pull/913#discussion_r356212899
 
 

 ##########
 File path: hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java
 ##########
 @@ -151,20 +149,18 @@ public synchronized boolean scheduleChore(ScheduledChore chore) {
 
     try {
       if (chore.getPeriod() <= 0) {
-        LOG.info("Chore {} is disabled because its period is not positive.", chore);
+        LOG.info("Chore {} is disabled because its period is not positive", chore);
         return false;
       }
-      LOG.info("Chore {} is enabled.", chore);
+      LOG.info("Chore {} is enabled", chore);
       chore.setChoreServicer(this);
       ScheduledFuture<?> future =
           scheduler.scheduleAtFixedRate(chore, chore.getInitialDelay(), chore.getPeriod(),
             chore.getTimeUnit());
       scheduledChores.put(chore, future);
       return true;
     } catch (Exception exception) {
-      if (LOG.isInfoEnabled()) {
-        LOG.info("Could not successfully schedule chore: " + chore.getName());
-      }
+      LOG.info("Could not successfully schedule chore: " + chore.getName());
 
 Review comment:
   @HorizonNet The `LOG.info` method will check internally if the log level is set to Info before emitting a log message, no need to do it twice.  Since the log message is INFO level, it's almost certainly going to be enabled when running in production so it's not worth being too clever with regards to performance so I wouldn't normally bother making it parameterized if it's not already.  However, I will make that adjustment since I'll emit the `chore` object instead of its `getName()`.
   
   Also, this should be an ERROR level logging, to include the stack trace.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services