tephra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anew <...@git.apache.org>
Subject [GitHub] incubator-tephra pull request #74: TEPHRA-266 Identify log messages when mul...
Date Thu, 26 Apr 2018 09:17:39 GMT
Github user anew commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/74#discussion_r184322363
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/coprocessor/TransactionStateCache.java
---
    @@ -184,4 +185,14 @@ private void refreshState() throws IOException {
       public TransactionVisibilityState getLatestState() {
         return latestState;
       }
    +
    +  protected void setId(@Nullable String id) {
    +    if (id != null) {
    +      this.logPrefix = "[" + id + "] ";
    +    }
    +  }
    +
    +  private String prefixLog(String message) {
    --- End diff --
    
    not sure this is a very good idea. It means you are performing the string operations even
when it is not being logged (for example, for debug messages). Better to add the logPrefix
as an argument to the log message, such as:
    ```
    LOG.debug("[{}] Latest transaction snapshot: {}", logPrefix, latestState.toString()));
    ``` 



---

Mime
View raw message