Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * See the file LICENSE for redistribution information.
  * Copyright (c) 2002,2010 Oracle and/or its affiliates.  All rights reserved.
Redirect the ConsoleHandler to use a specific Formatter. This is the same redirect approach used in, but in this case, an environment (and its associated stored console handler) is not available. In order to still have prefixed logging output, we incur the higher level cost of resetting the formatter.
    extends java.util.logging.ConsoleHandler {
     * We want console logging to be determined by the level for
     * Check that handler's level and use
     * it to set FormatterRedirectHandler explicitly.
    private static final String HANDLER_LEVEL = + ".level";
    public FormatterRedirectHandler() {
        String level = LoggerUtils.getLoggerProperty();
        setLevel((level == null) ? . : Level.parse(level));
    public void publish(LogRecord record) {
        Formatter formatter = 
        if (formatter != null) {
New to GrepCode? Check out our FAQ X