本文整理汇总了Java中ch.qos.logback.core.spi.FilterReply.DENY属性的典型用法代码示例。如果您正苦于以下问题:Java FilterReply.DENY属性的具体用法?Java FilterReply.DENY怎么用?Java FilterReply.DENY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ch.qos.logback.core.spi.FilterReply
的用法示例。
在下文中一共展示了FilterReply.DENY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decide
@Override
public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t)
{
//System.out.println("** Being called "+logger+"**"+level+"**"+marker);
ConfigValueTuple override = loggerOverrides.get(logger);
if(override != null)
{
Level configLevel = Level.toLevel(override.getLevel());
if(level.isGreaterOrEqual(configLevel))
return FilterReply.ACCEPT;
else
return FilterReply.DENY;
}
else
return FilterReply.NEUTRAL;
}
示例2: postInvoke
@Override
public void postInvoke(Request request, Response response)
throws IOException, ServletException {
final HttpServletRequest httpRequest = (HttpServletRequest) request.getRequest();
try {
CatalinaAdapter adapter = new CatalinaAdapter(request, response);
IAccessEvent accessEvent = new AccessEvent(httpRequest, (HttpServletResponse) response.getResponse(),
adapter);
if (ctx.getFilterChainDecision(accessEvent) == FilterReply.DENY) {
return;
}
// TODO better tion handling
ctx.callAppenders(accessEvent);
} finally {
httpRequest.removeAttribute(AccessConstants.LOGBACK_STATUS_MANAGER_KEY);
}
}
示例3: decide
@Override
public FilterReply decide(ILoggingEvent event) {
if (event.getFormattedMessage().contains("Received 404 error, please notify the developer and include the URL ("))
return FilterReply.DENY;
if (event.getMarker() != Markers.NO_ANNOUNCE && Launcher.getInstance().getClient().isReady() && event.getLevel() == Level.ERROR) {
String msg = event.getFormattedMessage();
if (event.getThrowableProxy() != null && event.getThrowableProxy() instanceof ThrowableProxy) {
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
Throwable throwable = ((ThrowableProxy) event.getThrowableProxy()).getThrowable();
if (throwable != null) {
msg += ' ';
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
throwable.printStackTrace(pw);
msg += sw.toString();
pw.close();
}
}
Messages.send(msg, Launcher.getInstance().getClient().getChannelByID("233632081110892546"));
}
return FilterReply.NEUTRAL;
}
示例4: decide
@Override
public FilterReply decide(ILoggingEvent event) {
String msg = event.getFormattedMessage();
if (msg.startsWith("Received 40")) {
return FilterReply.DENY;
}
if (msg.startsWith("Attempt to send message on closed")) {
return FilterReply.DENY;
}
if (event.getMarker() != Markers.NO_ANNOUNCE
&& FlareBot.getInstance().getClient() != null
&& FlareBot.getInstance().getClient().isReady()
&& event.getLevel() == Level.ERROR) {
EXECUTOR.submit(() -> {
Throwable throwable = null;
if (event.getThrowableProxy() != null && event.getThrowableProxy() instanceof ThrowableProxy) {
throwable = ((ThrowableProxy) event.getThrowableProxy()).getThrowable();
}
if (throwable != null) {
MessageUtils.sendException(msg, throwable, FlareBot.getInstance().getUpdateChannel());
} else MessageUtils.sendMessage(msg, FlareBot.getInstance().getUpdateChannel());
});
}
return FilterReply.NEUTRAL;
}
示例5: filterAndLog_0_Or3Plus
/**
* The next methods are not merged into one because of the time we gain by not
* creating a new Object[] with the params. This reduces the cost of not
* logging by about 20 nanoseconds.
*/
private void filterAndLog_0_Or3Plus(final String localFQCN,
final Marker marker, final Level level, final String msg,
final Object[] params, final Throwable t) {
final FilterReply decision = loggerContext
.getTurboFilterChainDecision_0_3OrMore(marker, this, level, msg,
params, t);
if (decision == FilterReply.NEUTRAL) {
if (effectiveLevelInt > level.levelInt) {
return;
}
} else if (decision == FilterReply.DENY) {
return;
}
buildLoggingEventAndAppend(localFQCN, marker, level, msg, params, t);
}
示例6: filterAndLog_2
private void filterAndLog_2(final String localFQCN,
final Marker marker, final Level level, final String msg,
final Object param1, final Object param2, final Throwable t) {
final FilterReply decision = loggerContext.getTurboFilterChainDecision_2(
marker, this, level, msg, param1, param2, t);
if (decision == FilterReply.NEUTRAL) {
if (effectiveLevelInt > level.levelInt) {
return;
}
} else if (decision == FilterReply.DENY) {
return;
}
buildLoggingEventAndAppend(localFQCN, marker, level, msg, new Object[] {
param1, param2 }, t);
}
示例7: decide
@Override
public FilterReply decide(Object event)
{
if (!isStarted())
{
return FilterReply.NEUTRAL;
}
LoggingEvent loggingEvent = (LoggingEvent) event;
List<Level> eventsToKeep = Arrays.asList(Level.TRACE, Level.DEBUG, Level.INFO);
if (eventsToKeep.contains(loggingEvent.getLevel()))
{
return FilterReply.NEUTRAL;
}
else
{
return FilterReply.DENY;
}
}
示例8: decide
@Override
public FilterReply decide(Object event)
{
if (!isStarted())
{
return FilterReply.NEUTRAL;
}
LoggingEvent loggingEvent = (LoggingEvent) event;
List<Level> eventsToKeep = Arrays.asList( Level.WARN, Level.ERROR );
if (eventsToKeep.contains(loggingEvent.getLevel()))
{
return FilterReply.NEUTRAL;
}
else
{
return FilterReply.DENY;
}
}
示例9: decide
@Override
public FilterReply decide(ILoggingEvent event) {
if(!isStarted())
return FilterReply.NEUTRAL;
if(logger != null && !event.getLoggerName().startsWith(logger))
return FilterReply.NEUTRAL;
if(exceptLogger != null && event.getLoggerName().startsWith(exceptLogger))
return FilterReply.NEUTRAL;
if(level != null && !event.getLevel().isGreaterOrEqual(level))
return FilterReply.DENY;
return FilterReply.NEUTRAL;
}
示例10: decide
@Override
public FilterReply decide(final ILoggingEvent event) {
if (!isStarted()) {
return FilterReply.NEUTRAL;
}
if (levelMin != null && event.getLevel().levelInt < levelMin.levelInt) {
return FilterReply.DENY;
}
if (levelMax != null && event.getLevel().levelInt > levelMax.levelInt) {
return FilterReply.DENY;
}
return FilterReply.NEUTRAL;
}
示例11: decide
@Override
public FilterReply decide(ILoggingEvent e) {
if(!evicting.isAlive()){
log.info("Starting up thread {}.", evicting.getName());
evicting.start();
}
String message = e.getFormattedMessage();
long timestamp = e.getTimeStamp();
Long lastTimestamp = cache.timestampOfLastOccurence(message);
cache.put(message, timestamp);
FilterReply result;
if (lastTimestamp != null) {
long deltaFromLastOccurence = timestamp - lastTimestamp;
result = (deltaFromLastOccurence > maxAgeInMillis) ? FilterReply.NEUTRAL
: FilterReply.DENY;
} else {
result = FilterReply.NEUTRAL;
}
return result;
}
示例12: decide
@Override
public FilterReply decide(ILoggingEvent event) {
final IThrowableProxy throwableProxy = event.getThrowableProxy();
if (throwableProxy == null) {
return FilterReply.NEUTRAL;
}
if (!(throwableProxy instanceof ThrowableProxy)) {
return FilterReply.NEUTRAL;
}
final ThrowableProxy throwableProxyImpl = (ThrowableProxy) throwableProxy;
final Throwable throwable = throwableProxyImpl.getThrowable();
if (java.nio.channels.ClosedChannelException.class.isInstance(throwable)) {
return FilterReply.DENY;
}
return FilterReply.NEUTRAL;
}
示例13: decide
@Override
public FilterReply decide(ILoggingEvent event)
{
if (event.getMarker().getName().equals("pircbotx.output") && (event.getMessage().contains("NICKSERV IDENTIFY") || event.getMessage().contains("PASS ")))
{
return FilterReply.DENY;
}
if (event.getMessage().contains("\u0003"))
{
FoxBot.getInstance().getLogger().info(Colors.removeFormattingAndColors(event.getMessage()));
return FilterReply.DENY;
}
return FilterReply.NEUTRAL;
}
示例14: decide
@Override
public FilterReply decide(ILoggingEvent event) {
if (event.getMessage().contains("changed presence") && event.getLoggerName().equals("sx.blah.discord.Discord4J")) {
return FilterReply.DENY;
}
return FilterReply.NEUTRAL;
}
示例15: decide
@Override
public FilterReply decide(ILoggingEvent event) {
Marker eventMarker = event.getMarker();
if (isStarted() && (eventMarker == null || !eventMarker.contains(METRIC_MARKER))) {
return FilterReply.DENY;
} else {
return FilterReply.NEUTRAL;
}
}