Java Code Examples for ch.qos.logback.core.Appender#getName()

The following examples show how to use ch.qos.logback.core.Appender#getName() . 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: DiagnosticLogSystem.java    From synopsys-detect with Apache License 2.0 5 votes vote down vote up
private void restrictConsoleToDebug() {
    for (final Iterator<Appender<ILoggingEvent>> it = DiagnosticLogUtil.getRootLogger().iteratorForAppenders(); it.hasNext(); ) {
        final Appender appender = it.next();
        if (appender.getName() != null && appender.getName().equals("CONSOLE")) {
            final ThresholdFilter levelFilter = new ThresholdFilter();
            levelFilter.setLevel(Level.DEBUG.levelStr);
            levelFilter.start();
            appender.addFilter(levelFilter);
        }
    }
}
 
Example 2
Source File: LogConfigurator.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void end(InterpretationContext ec, String arg1) {
	Object o = ec.peekObject();
	if (o != className) {
		addWarn("The object on the top the of the stack is not the logreader classname pushed earlier.");
	} else {
		ec.popObject();
		Appender<?> appender = (Appender<?>) ec.peekObject();
		logReaderClassNames.put(appender.getName(), className);
		appenders.put(appender.getName(), appender);
		if (def) {
			defaultAppender = appender.getName();
		}
	}
}
 
Example 3
Source File: LogControlImpl.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected Map<String, Appender> getAllAppenders() {
    Map<String, Appender> map = new HashMap<>();
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    for (Logger logger : context.getLoggerList()) {
        for (Iterator<Appender<ILoggingEvent>> index = logger.iteratorForAppenders(); index.hasNext();) {
            Appender<ILoggingEvent> appender = index.next();
            if (appender.getName() != null) {
                map.put(appender.getName(), appender);
            }
        }
    }
    return map;
}