Java Code Examples for ch.qos.logback.core.spi.FilterReply#ACCEPT

The following examples show how to use ch.qos.logback.core.spi.FilterReply#ACCEPT . 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: LogFilter.java    From DimpleBlog with Apache License 2.0 6 votes vote down vote up
@Override
public FilterReply decide(ILoggingEvent event) {
    StringBuilder exception = new StringBuilder();
    IThrowableProxy iThrowableProxy1 = event.getThrowableProxy();
    if (iThrowableProxy1 != null) {
        exception.append("<span class='excehtext'>" + iThrowableProxy1.getClassName() + " " + iThrowableProxy1.getMessage() + "</span></br>");
        for (int i = 0; i < iThrowableProxy1.getStackTraceElementProxyArray().length; i++) {
            exception.append("<span class='excetext'>" + iThrowableProxy1.getStackTraceElementProxyArray()[i].toString() + "</span></br>");
        }
    }
    LoggerMessage loggerMessage = new LoggerMessage(
            event.getMessage()
            , DateFormat.getDateTimeInstance().format(new Date(event.getTimeStamp())),
            event.getThreadName(),
            event.getLoggerName(),
            event.getLevel().levelStr,
            exception.toString(),
            ""
    );
    LoggerQueue.getInstance().push(loggerMessage);
    return FilterReply.ACCEPT;
}
 
Example 2
Source File: ChatLogFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if chatlog,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[MESSAGE]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 3
Source File: LoggerNameAndLevelFilter.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
private FilterReply getWildCardLoggerFilterReply(final Level eventLevel)
{
    if (eventLevel.isGreaterOrEqual(_level))
    {
        return FilterReply.ACCEPT;
    }
    else
    {
        return FilterReply.NEUTRAL;
    }
}
 
Example 4
Source File: LogFilter.java    From seed with Apache License 2.0 5 votes vote down vote up
@Override
public FilterReply decide(ILoggingEvent event) {
    LogMsg msg = new LogMsg();
    msg.setBody(event.getMessage());
    msg.setLevel(event.getLevel().levelStr);
    msg.setTimestamp(DateFormat.getDateTimeInstance().format(new Date(event.getTimeStamp())));
    msg.setClassName(event.getLoggerName());
    msg.setThreadName(event.getThreadName());
    LogQueue.getInstance().push(msg);
    return FilterReply.ACCEPT;
}
 
Example 5
Source File: SystemMailServiceFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[SYSMAILSERVICE]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 6
Source File: PredicateAndLoggerNameAndLevelFilter.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
protected Filter<ILoggingEvent> createFilter(final String loggerName)
{
    final Filter<ILoggingEvent> filter = super.createFilter(loggerName);
    return new Filter<ILoggingEvent>()
    {
        @Override
        public FilterReply decide(final ILoggingEvent event)
        {
            final FilterReply result = filter.decide(event);
            if (result == FilterReply.ACCEPT)
            {
                if (_predicate.evaluate(event))
                {
                    return FilterReply.ACCEPT;
                }
                else
                {
                    return FilterReply.NEUTRAL;
                }
            }
            else
            {
                return result;
            }
        }
    };
}
 
Example 7
Source File: DropFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[DROP]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 8
Source File: InGameShopFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[INGAMESHOP]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 9
Source File: SiegeFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[SIEGE]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 10
Source File: ConsoleFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
@Override
public FilterReply decide(ILoggingEvent event) {
	if ((event.getMessage().startsWith("[MESSAGE]")) || (event.getMessage().startsWith("[ITEM]"))
			|| (event.getMessage().startsWith("[ADMIN COMMAND]")) || (event.getMessage().startsWith("[AUDIT]"))) {
		return FilterReply.DENY;
	}
	return FilterReply.ACCEPT;
}
 
Example 11
Source File: ThrowablePresentFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (message instanceof Throwable) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 12
Source File: AutoGroupFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[AUTOGROUPSERVICE]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 13
Source File: GmAuditFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[ADMIN COMMAND]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 14
Source File: ItemFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[ITEM]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 15
Source File: CraftFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decides what to do with logging event.<br>
 * This method accepts only log events that contain exceptions.
 * 
 * @param loggingEvent
 *            log event that is going to be filtred.
 * @return {@link org.apache.log4j.spi.Filter#ACCEPT} if admin command,
 *         {@link org.apache.log4j.spi.Filter#DENY} otherwise
 */
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[CRAFT]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 16
Source File: VeteranRewardsFilter.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
@Override
public FilterReply decide(ILoggingEvent loggingEvent) {
	Object message = loggingEvent.getMessage();

	if (((String) message).startsWith("[VETERANREWARD]")) {
		return FilterReply.ACCEPT;
	}
	return FilterReply.DENY;
}
 
Example 17
Source File: QpidLoggerTurboFilter.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public FilterReply decide(final Marker marker,
                          final Logger logger,
                          final Level level,
                          final String format,
                          final Object[] params,
                          final Throwable t)
{
    if (level.levelInt  < _minimumFilterLevel)
    {
        // Optimisation - no filters accept an event with this level
        return FilterReply.DENY;
    }

    final ConcurrentMap<Logger, Integer> effectiveLevels = _effectiveLevels.get();
    Integer effectiveLoggerLevel = effectiveLevels.get(logger);
    if(effectiveLoggerLevel == null)
    {
        effectiveLoggerLevel = Level.OFF.levelInt;
        for (EffectiveLevelFilter filter : _filters)
        {
            Integer loggerLevel = filter.getEffectiveLevel(logger).levelInt;
            if (effectiveLoggerLevel >= loggerLevel)
            {
                effectiveLoggerLevel = loggerLevel;
            }
        }
        effectiveLevels.putIfAbsent(logger, effectiveLoggerLevel);
    }

    return level.levelInt >= effectiveLoggerLevel ? FilterReply.ACCEPT : FilterReply.DENY;
}
 
Example 18
Source File: LogbackLoggingConfigurer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) {
    Level loggerLevel = logger.getEffectiveLevel();
    if (loggerLevel == Level.INFO && (level == Level.INFO || level == Level.WARN)
            || level == Level.INFO && (loggerLevel == Level.INFO || loggerLevel == Level.WARN)) {
        // Need to take into account Gradle's LIFECYCLE and QUIET markers. Whether those are set can only be determined
        // for the global log level, but not for the logger's log level (at least not without walking the logger's
        // hierarchy, which is something that Logback is designed to avoid for performance reasons).
        // Hence we base our decision on the global log level.
        LogLevel eventLevel = LogLevelConverter.toGradleLogLevel(level, marker);
        return eventLevel.compareTo(currentLevel) >= 0 ? FilterReply.ACCEPT : FilterReply.DENY;
    }

    return level.isGreaterOrEqual(loggerLevel) ? FilterReply.ACCEPT : FilterReply.DENY;
}
 
Example 19
Source File: DiagnosticLogging.java    From hivemq-community-edition with Apache License 2.0 5 votes vote down vote up
@Override
public FilterReply decide(final ILoggingEvent event) {
    if (event.getLevel().toInt() < originalLevel.toInt()) {
        return FilterReply.DENY;
    } else {
        return FilterReply.ACCEPT;
    }
}
 
Example 20
Source File: LoggerNameAndLevelFilter.java    From qpid-broker-j with Apache License 2.0 4 votes vote down vote up
private FilterReply getExactLoggerFilterReply(final Level eventLevel)
{
    return  eventLevel.isGreaterOrEqual(_level) ? FilterReply.ACCEPT : FilterReply.DENY;
}