/** * Sets synchronicity of logging writes. By default, writes are asynchronous. * * @param synchronicity {@link Synchronicity} */ public void setSynchronicity(Synchronicity synchronicity) { getLogging().setWriteSynchronicity(synchronicity); }
/** Get the flush log level. */ public Synchronicity getSynchronicity() { return getLogging().getWriteSynchronicity(); }
/** * Sets minimum logging level to log immediately and flush any pending writes. * * @param flushLevel minimum log level to trigger flush */ public void setFlushLevel(Level flushLevel) { this.flushLevel = flushLevel; getLogging().setFlushSeverity(severityFor(flushLevel)); }
@Override public void flush() { try { getLogging().flush(); } catch (Exception ex) { getErrorManager().error(null, ex, ErrorManager.FLUSH_FAILURE); } }
@Override public void publish(LogRecord record) { // check that the log record should be logged if (!isLoggable(record)) { return; } // HACK warning: this logger doesn't work like normal loggers; the log calls are issued // from another class instead of by itself, so it can't be configured off like normal // loggers. We have to check the source class name instead. if ("io.netty.handler.codec.http2.Http2FrameLogger".equals(record.getSourceClassName())) { return; } LogEntry logEntry; try { logEntry = logEntryFor(record); } catch (Exception ex) { getErrorManager().error(null, ex, ErrorManager.FORMAT_FAILURE); return; } if (logEntry != null) { try { getLogging().write(ImmutableList.of(logEntry), defaultWriteOptions); } catch (Exception ex) { getErrorManager().error(null, ex, ErrorManager.WRITE_FAILURE); } } }
}; getLogging().setFlushSeverity(severityFor(flushLevel)); getLogging().setWriteSynchronicity(config.getSynchronicity());
/** * Sets synchronicity of logging writes. By default, writes are asynchronous. * * @param synchronicity {@link Synchronicity} */ public void setSynchronicity(Synchronicity synchronicity) { getLogging().setWriteSynchronicity(synchronicity); }
/** Get the flush log level. */ public Synchronicity getSynchronicity() { return getLogging().getWriteSynchronicity(); }
/** * Sets minimum logging level to log immediately and flush any pending writes. * * @param flushLevel minimum log level to trigger flush */ public void setFlushLevel(Level flushLevel) { this.flushLevel = flushLevel; getLogging().setFlushSeverity(severityFor(flushLevel)); }
@Override public void flush() { try { getLogging().flush(); } catch (Exception ex) { getErrorManager().error(null, ex, ErrorManager.FLUSH_FAILURE); } }
@Override public void publish(LogRecord record) { // check that the log record should be logged if (!isLoggable(record)) { return; } // HACK warning: this logger doesn't work like normal loggers; the log calls are issued // from another class instead of by itself, so it can't be configured off like normal // loggers. We have to check the source class name instead. if ("io.netty.handler.codec.http2.Http2FrameLogger".equals(record.getSourceClassName())) { return; } LogEntry logEntry; try { logEntry = logEntryFor(record); } catch (Exception ex) { getErrorManager().error(null, ex, ErrorManager.FORMAT_FAILURE); return; } if (logEntry != null) { try { getLogging().write(ImmutableList.of(logEntry), defaultWriteOptions); } catch (Exception ex) { getErrorManager().error(null, ex, ErrorManager.WRITE_FAILURE); } } }
}; getLogging().setFlushSeverity(severityFor(flushLevel)); getLogging().setWriteSynchronicity(config.getSynchronicity());