Example usage for java.util.logging Handler Handler

List of usage examples for java.util.logging Handler Handler

Introduction

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

Prototype

protected Handler() 

Source Link

Document

Default constructor.

Usage

From source file:com.ellychou.todo.rest.service.SpringContextJerseyTest.java

/**
* Retrieves {@link Handler log handler} capable of storing {@link LogRecord logged records}.
*
* @return log handler./*from  w w w. j  av a 2  s  .  co m*/
*/
private Handler getLogHandler() {
    if (logHandler == null) {
        final Integer logLevel = Integer.valueOf(getProperty(TestProperties.RECORD_LOG_LEVEL));
        logHandler = new Handler() {

            @Override
            public void publish(LogRecord record) {
                final String loggerName = record.getLoggerName();

                if (record.getLevel().intValue() >= logLevel && loggerName.startsWith("org.glassfish.jersey")
                        && !loggerName.startsWith("org.glassfish.jersey.test")) {
                    loggedRuntimeRecords.add(record);
                }
            }

            @Override
            public void flush() {
            }

            @Override
            public void close() throws SecurityException {
            }
        };
    }
    return logHandler;
}