void doFlush() {
        if (logger != null && loggerBuffer != null) {
            if ((logger.isDebugEnabled() && debug) || logger.isInfoEnabled() && !debug) {
                String logLine = loggerBuffer.toString(StreamUtil.DEFAULT_CHARSET);
                if (logLine.endsWith("\n")) {
                    logLine = logLine.substring(0, logLine.length() - 1);
                }
                if (logLine.length() > 0) {
                    // Any watch Terms
                    if (watchTerms != null) {
                        for (Entry<String, AtomicInteger> watchTerm : watchTerms.entrySet()) {
                            int startIndex = -1;
                            while ((startIndex = logLine.indexOf(watchTerm.getKey(), startIndex + 1)) != -1) {
                                watchTerm.getValue().incrementAndGet();
                            }
                        }
                    }
                    if (debug) {
                        logger.debug(logLine);
                    } else {
                        logger.info(logLine);
                    }
                }
            }
            loggerBuffer.reset();
        }
    }
This logger can also look out for lines being written in the log.
stroom-util/src/main/java/stroom/util/logging/LoggerPrintStream.java