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

The following examples show how to use ch.qos.logback.core.spi.FilterReply#DENY . 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: XodusFileDataWriterLogLevelModificator.java    From hivemq-community-edition with Apache License 2.0 6 votes vote down vote up
@Override
public FilterReply decide(final Marker marker, final ch.qos.logback.classic.Logger logger, final Level level, final String format, final Object[] params, final Throwable t) {

    if (level.isGreaterOrEqual(Level.WARN)) {
        if (logger.getName().equals(fileDataWriterLogger.getName())) {
            if (format != null) {
                if (format.startsWith("Can't open directory channel. Log directory fsync won't be performed.")) {
                    if (first.getAndSet(false)) {
                        log.debug("Can't open directory channel. Log directory fsync won't be performed.");
                    }
                    return FilterReply.DENY;
                }
            }
        }

    }
    return FilterReply.NEUTRAL;
}
 
Example 2
Source File: NettyLogLevelModifier.java    From hivemq-community-edition with Apache License 2.0 6 votes vote down vote up
@NotNull
private FilterReply traceAndSortOutUnsupportedOperationException(final Marker marker, final Logger logger,
                                                                 final String format, final Object[] params, final Throwable t) {
    if (t instanceof UnsupportedOperationException) {
        return FilterReply.DENY;
    }
    if (params == null) {
        logger.trace(marker, format, params);
        return FilterReply.DENY;
    }
    final Object[] paramList = params;
    for (final Object param : paramList) {
        if (param instanceof UnsupportedOperationException) {
            return FilterReply.DENY;
        }
    }
    logger.trace(marker, format, params);
    return FilterReply.DENY;
}
 
Example 3
Source File: NettyLogLevelModifier.java    From hivemq-community-edition with Apache License 2.0 6 votes vote down vote up
@NotNull
private FilterReply sortOutUnsupportedOperationException(final Object[] params, final Throwable t) {
    if (t instanceof UnsupportedOperationException) {
        return FilterReply.DENY;
    }
    if (params == null) {
        return FilterReply.NEUTRAL;
    }
    final Object[] paramList = params;
    for (final Object param : paramList) {
        if (param instanceof UnsupportedOperationException) {
            return FilterReply.DENY;
        }
    }
    return FilterReply.NEUTRAL;
}
 
Example 4
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 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: 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 7
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 8
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 9
Source File: ApimlDependencyLogHider.java    From api-layer with Eclipse Public License 2.0 5 votes vote down vote up
private FilterReply getFilterReply(String format) {
    boolean ignored =  IGNORED_MESSAGE_KEYWORDS.stream()
        .anyMatch(keyword -> {
            if (keyword.contains(".*")) {
                return format.matches(keyword);
            } else {
                return format.contains(keyword);
            }
        });
    return ignored ? FilterReply.DENY : FilterReply.NEUTRAL;
}
 
Example 10
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 11
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 12
Source File: PrincipalLogEventFilter.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public FilterReply decide(ILoggingEvent event)
{
    Subject subject = Subject.getSubject(AccessController.getContext());
    if (subject != null && subject.getPrincipals().contains(_principal))
    {
        return FilterReply.NEUTRAL;
    }
    return FilterReply.DENY;
}
 
Example 13
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 14
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 15
Source File: DefaultLogbackFilterGenerator.java    From sofa-common-tools with Apache License 2.0 5 votes vote down vote up
@Override
public FilterReply decide(Marker marker,
                          ch.qos.logback.classic.Logger logger,
                          Level level,
                          String format,
                          Object[] params,
                          Throwable t) {
    return FilterReply.DENY;
}
 
Example 16
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 17
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 18
Source File: LogbackLoggingSystem.java    From super-cloudops with Apache License 2.0 4 votes vote down vote up
@Override
public FilterReply decide(Marker marker, ch.qos.logback.classic.Logger logger, Level level, String format,
		Object[] params, Throwable t) {
	return FilterReply.DENY;
}
 
Example 19
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;
}
 
Example 20
Source File: NettyLogLevelModifier.java    From hivemq-community-edition with Apache License 2.0 4 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 (format == null || logger == null) {
        return FilterReply.NEUTRAL;
    }

    if (logger.getName() == null) {
        return FilterReply.NEUTRAL;
    }

    if (level == Level.DEBUG) {

        if (logger.getName().startsWith("io.netty.handler.traffic.")) {
            return FilterReply.DENY;
        } else if (logger.getName().contains("io.netty.util.internal.NativeLibraryLoader")) {
            if (t instanceof UnsatisfiedLinkError) {
                return FilterReply.DENY;
            }
            if (params == null) {
                logger.trace(marker, format, params);
                return FilterReply.DENY;
            }
            final Object[] paramList = params;
            for (final Object param : paramList) {
                if (param instanceof UnsatisfiedLinkError) {
                    return FilterReply.DENY;
                }
            }
            logger.trace(marker, format, params);
            return FilterReply.DENY;
        } else if (logger.getName().startsWith("io.netty")) {
            return traceAndSortOutUnsupportedOperationException(marker, logger, format, params, t);
        }

    } else if (level == Level.TRACE) {
        if (logger.getName().contains("io.netty.channel.nio.NioEventLoop")) {
            return sortOutUnsupportedOperationException(params, t);
        }
    }

    return FilterReply.NEUTRAL;
}