You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/02/22 12:52:20 UTC

[GitHub] [cloudstack] GutoVeronezi commented on a change in pull request #4707: Improve logs on HAManagerImpl

GutoVeronezi commented on a change in pull request #4707:
URL: https://github.com/apache/cloudstack/pull/4707#discussion_r580226027



##########
File path: server/src/main/java/org/apache/cloudstack/ha/HAManagerImpl.java
##########
@@ -156,19 +156,16 @@ public boolean transitionHAState(final HAConfig.Event event, final HAConfig haCo
             if (result) {
                 final String message = String.format("Transitioned host HA state from:%s to:%s due to event:%s for the host id:%d",
                         currentHAState, nextState, event, haConfig.getResourceId());
-                if (LOG.isTraceEnabled()) {
-                    LOG.trace(message);
-                }
+                LOG.debug(message);

Review comment:
       @DaanHoogland About removing the `isEnabled`, if you take a look at the methods (`debug`, `trace`, or others) on [Logger](https://github.com/apache/log4j/blob/trunk/src/main/java/org/apache/log4j/Logger.java) and [Category](https://github.com/apache/log4j/blob/trunk/src/main/java/org/apache/log4j/Category.java), you will notice that they already do the same validation as the `isEnabled` do, the only thing that the `if` would avoid is that in some cases the string to be logged would not be created; In an async web app, like `ACS`, it is not relevant to safe this "cost" by adding more lines to the codebase.
   
   About changing the log level to `debug`, in this context, these messages work better as `debug`; as well, it is quite unusual to call `trace` on `ACS`, so, it is interesting to keep a pattern and use `debug`.




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