class OncePerMessageLoggingFilter implements LoggingFilter {

  @Override
  public synchronized boolean canLog(String msg) {
    // Do not log if filtering is on and message has already been logged
    if (filtering && messagesLogged.contains(msg)) {
      return false;
    }
    messagesLogged.add(msg);
    return true;
  }

}