Package java.util.logging

Examples of java.util.logging.ConsoleHandler


     *
     * @since 2.0
     */
    public static void setLevel(String loggerNamespace, Level outputLevel) {
        Logger appRooLogger = Logger.getLogger(loggerNamespace);
        Handler verboseHandler = new ConsoleHandler();
        verboseHandler.setLevel(outputLevel);
        appRooLogger.addHandler(verboseHandler);
        appRooLogger.setLevel(outputLevel);
        appRooLogger.setUseParentHandlers(false);
    }
View Full Code Here


    }

    @SuppressWarnings("ManualArrayToCollectionCopy")
    private static void setUpLogger() {
        logger.setLevel(Level.FINER);
        ConsoleHandler ch = new ConsoleHandler();
        ch.setLevel(Level.ALL);
        Set<Handler> handlersToDestroy = new HashSet<Handler>();
        Collections.addAll(handlersToDestroy, logger.getHandlers());
        for (Handler h : handlersToDestroy) {
            logger.removeHandler(h);
        }
View Full Code Here

  private final Logger logger;

  public ServerLogImplJDK14() {
    logger = Logger.getLogger("gwt-log");
    logger.setUseParentHandlers(false);
    ConsoleHandler consoleHandler = new ConsoleHandler();
    consoleHandler.setLevel(Level.ALL);
    logger.addHandler(consoleHandler);
  }
View Full Code Here

            e.printStackTrace();
        }
    }

    private static void configureLogging() {
        ConsoleHandler handler = new ConsoleHandler();
        Logger root = Logger.getLogger("");
        root.addHandler(handler);
        handler.setLevel(Level.FINER);
        root.setLevel(Level.FINER);
    }
View Full Code Here

            e.printStackTrace();
        }
    }

    private static void configureLogging() {
        ConsoleHandler handler = new ConsoleHandler();
        Logger root = Logger.getLogger("");
        root.addHandler(handler);
        handler.setLevel(Level.FINER);
        root.setLevel(Level.FINER);
    }
View Full Code Here

            e.printStackTrace();
        }
    }

    private static void configureLogging() {
        ConsoleHandler handler = new ConsoleHandler();
        Logger root = Logger.getLogger("");
        root.addHandler(handler);
        // handler.setLevel(Level.FINER);
        // root.setLevel(Level.FINER);
    }
View Full Code Here

                sb.append(record.getMessage());
                sb.append("\n");
                return sb.toString();
            }
        };
        Handler ch = new ConsoleHandler();
        ch.setFormatter(sf);
        Logger globalLog = Logger.getLogger("");
        globalLog.addHandler(ch);
       
        ch.setLevel(consoleLevel);
    }
View Full Code Here

            // Set all console handlers to shup up except for important messages
            final Handler[] handlers = Logger.getLogger("").getHandlers();
            for (final Handler handler : handlers) {
                if (handler instanceof ConsoleHandler) {
                    final ConsoleHandler c = (ConsoleHandler) handler;
                    c.setLevel(Level.FINE);
                }
            }
        } else {
            // Set configuration for logger.
            Logger.getLogger("").setLevel(level);
            Logger.getLogger("java").setLevel(Level.WARNING);

            // Set all console handlers to shup up except for important messages
            final Handler[] handlers = Logger.getLogger("").getHandlers();
            for (final Handler handler : handlers) {
                if (handler instanceof ConsoleHandler) {
                    final ConsoleHandler c = (ConsoleHandler) handler;
                    c.setLevel(level);
                }
            }
        }

    }
View Full Code Here

    httpLogger.setLevel(Level.ALL);
    Logger xmlLogger = Logger.getLogger("com.google.gdata.util.XmlParser");
    xmlLogger.setLevel(Level.ALL);

    // Create a log handler which prints all log events to the console
    ConsoleHandler logHandler = new ConsoleHandler();
    logHandler.setLevel(Level.ALL);
    httpLogger.addHandler(logHandler);
    xmlLogger.addHandler(logHandler);
  }
View Full Code Here

    /*=================================
          Main class implementation
     *=================================*/

    public static void main(String[] args) throws Exception {
        Handler fh = new ConsoleHandler();
        fh.setLevel(Level.FINEST);
        fh.setFormatter(new Formatter() {
            @Override
            public String format(LogRecord record) {
                String message = formatMessage(record);
                String throwable = "";
                if (record.getThrown() != null) {
View Full Code Here

TOP

Related Classes of java.util.logging.ConsoleHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.