Java Code Examples for ch.qos.logback.core.Appender#setName()
The following examples show how to use
ch.qos.logback.core.Appender#setName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractLogger.java From qpid-broker-j with Apache License 2.0 | 6 votes |
@Override protected void postResolveChildren() { super.postResolveChildren(); LoggerContext loggerContext = ROOT_LOGGER.getLoggerContext(); Appender<ILoggingEvent> appender = createAppenderInstance(loggerContext); appender.setName(getName()); appender.setContext(loggerContext); for(LogInclusionRule logInclusionRule : getLogInclusionRules()) { _compositeFilter.addLogInclusionRule((LogBackLogInclusionRule)logInclusionRule); } appender.addFilter(_compositeFilter); ROOT_LOGGER.addAppender(appender); appender.start(); // TODO generalise for virtualhost too StartupAppender startupAppender = (StartupAppender) ROOT_LOGGER.getAppender(StartupAppender.class.getName()); if (startupAppender != null) { startupAppender.replayAccumulatedEvents(appender); } }
Example 2
Source File: LogUtil.java From audiveris with GNU Affero General Public License v3.0 | 5 votes |
/** * Add a specific appender meant for GUI log pane. * To be called only when running with a GUI. */ public static void addGuiAppender () { // GUI (filtered in LogGuiAppender) LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger( Logger.ROOT_LOGGER_NAME); Appender guiAppender = new LogGuiAppender(); guiAppender.setName("GUI"); guiAppender.setContext(loggerContext); guiAppender.start(); root.addAppender(guiAppender); }
Example 3
Source File: AbstractBaleenLoggerBuilder.java From baleen with Apache License 2.0 | 5 votes |
/** * Build a new appender for the specified context and encoder (where required). * * @param context The logger context * @param encoder The encoder to use (if that is possible for the specific appender) * @return The new appender */ @Override public final Appender<ILoggingEvent> build( LoggerContext context, Encoder<ILoggingEvent> encoder) { Appender<ILoggingEvent> appender = createAppender(context, encoder); appender.setName(name); appender.setContext(context); if (filters != null) { filters.forEach(appender::addFilter); } return appender; }