Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. In general logging is a good idea.
  2. Use Commons Logging.
  3. For debug messages, call if (log.isDebugEnabled()) prior to calling log.debug().
  4. The following code is usually bad. There is no need to log exception and re-throw it:
    Code Block
    try {
        
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        throw new RuntimeException(e);
    }
    
    Either log it, or re-throw.

Logging Messages

  1. Messages which are visible to the end user should have their strings externalized and read from a properties file to allow for easier NLS translation.
  2. Debug messages do not need to be put into a properties file.

Formatting

In a perfect world all people, who contribute code, use the same IDE with the same formatting preferences which, for example, significantly reduces a number of redundant SVN merges.

...