Example usage for java.util.logging MemoryHandler getLevel

List of usage examples for java.util.logging MemoryHandler getLevel

Introduction

In this page you can find the example usage for java.util.logging MemoryHandler getLevel.

Prototype

public Level getLevel() 

Source Link

Document

Get the log level specifying which messages will be logged by this Handler .

Usage

From source file:MailHandlerDemo.java

/**
 * Example for circular buffer behavior. The level, push level, and capacity
 * are set the same so that the memory handler push results in a mail
 * handler push. All messages are high priority. On close any remaining
 * records are discarded because they never reach the mail handler.      <code>
 * ##logging.properties//  www.  j ava2s .  co m
 * MailHandlerDemo.handlers=java.util.logging.MemoryHandler
 * java.util.logging.MemoryHandler.target=com.sun.mail.util.logging.MailHandler
 * com.sun.mail.util.logging.MailHandler.level=ALL
 * java.util.logging.MemoryHandler.level=ALL
 * java.util.logging.MemoryHandler.push=WARNING
 * com.sun.mail.util.logging.MailHandler.subject=Push only demo
 * com.sun.mail.util.logging.MailHandler.pushLevel=WARNING
 * ##
 * </code>
 */
private static void initPushOnly() {
    final int capacity = 3;
    final Level pushLevel = Level.WARNING;
    final MailHandler h = new MailHandler(capacity);
    h.setPushLevel(pushLevel);
    h.setSubject("Push only demo");
    MemoryHandler m = new MemoryHandler(h, capacity, pushLevel);
    h.setLevel(m.getLevel());
    LOGGER.addHandler(m);
    pushOnlyHandler = h;
}