当前位置: 首页>>代码示例>>Java>>正文


Java Filter.NEUTRAL属性代码示例

本文整理汇总了Java中org.apache.log4j.spi.Filter.NEUTRAL属性的典型用法代码示例。如果您正苦于以下问题:Java Filter.NEUTRAL属性的具体用法?Java Filter.NEUTRAL怎么用?Java Filter.NEUTRAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.log4j.spi.Filter的用法示例。


在下文中一共展示了Filter.NEUTRAL属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doAppend

/**
 * 覆写doAppend, 去掉closed的log日志
 * @param event
 */
@Override
public synchronized void doAppend(LoggingEvent event) {
    if (closed) {
        return;
    }

    if (!isAsSevereAsThreshold(event.getLevel())) {
        return;
    }

    Filter f = this.headFilter;

    FILTER_LOOP:
    while(f != null) {
        switch(f.decide(event)) {
            case Filter.DENY: return;
            case Filter.ACCEPT: break FILTER_LOOP;
            case Filter.NEUTRAL: f = f.getNext();
        }
    }

    this.append(event);
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:27,代码来源:KafkaAppender.java

示例2: doAppend

/**
  * This method performs threshold checks and invokes filters before
  * delegating actual logging to the subclasses specific {@link
  * AppenderSkeleton#append} method.
  * */
public
synchronized 
void doAppend(LoggingEvent event) {
  if(closed) {
    LogLog.error("Attempted to append to closed appender named ["+name+"].");
    return;
  }
  
  if(!isAsSevereAsThreshold(event.getLevel())) {
    return;
  }

  Filter f = this.headFilter;
  
  FILTER_LOOP:
  while(f != null) {
    switch(f.decide(event)) {
    case Filter.DENY: return;
    case Filter.ACCEPT: break FILTER_LOOP;
    case Filter.NEUTRAL: f = f.getNext();
    }
  }
  
  this.append(event);    
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:30,代码来源:AppenderSkeleton.java

示例3: decide

/**
   Return the decision of this filter.

   Returns {@link Filter#NEUTRAL} if the <b>LevelToMatch</b> option
   is not set or if there is not match.  Otherwise, if there is a
   match, then the returned decision is {@link Filter#ACCEPT} if the
   <b>AcceptOnMatch</b> property is set to <code>true</code>. The
   returned decision is {@link Filter#DENY} if the
   <b>AcceptOnMatch</b> property is set to false.

*/
public
int decide(LoggingEvent event) {
  if(this.levelToMatch == null) {
    return Filter.NEUTRAL;
  }
  
  boolean matchOccured = false;
  if(this.levelToMatch.equals(event.getLevel())) {
    matchOccured = true;
  } 

  if(matchOccured) {  
    if(this.acceptOnMatch)
 return Filter.ACCEPT;
    else
 return Filter.DENY;
  } else {
    return Filter.NEUTRAL;
  }
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:31,代码来源:LevelMatchFilter.java

示例4: decide

/**
    Returns {@link Filter#NEUTRAL} is there is no string match.
  */
 public
 int decide(LoggingEvent event) {
   String msg = event.getRenderedMessage();

   if(msg == null ||  stringToMatch == null)
     return Filter.NEUTRAL;
   

   if( msg.indexOf(stringToMatch) == -1 ) {
     return Filter.NEUTRAL;
   } else { // we've got a match
     if(acceptOnMatch) {
return Filter.ACCEPT;
     } else {
return Filter.DENY;
     }
   }
 }
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:21,代码来源:StringMatchFilter.java

示例5: doAppend

/**
  * This method performs threshold checks and invokes filters before
  * delegating actual logging to the subclasses specific {@link
  * AppenderSkeleton#append} method.
  * */
public
synchronized 
void doAppend(LoggingEvent event) {
  if(closed) {
    LogLog.error("Attempted to append to closed appender named ["+name+"].");
    return;
  }
  
  if(!isAsSevereAsThreshold(event.getLevel())) {
    return;
  }

  Filter f = this.headFilter;
  
  FILTER_LOOP:
  while(f != null) {
    switch(f.decide(event)) {
    case Filter.DENY: return;
    case Filter.ACCEPT: break FILTER_LOOP;
    case Filter.NEUTRAL: f = f.next;
    }
  }
  
  this.append(event);    
}
 
开发者ID:nologic,项目名称:nabs,代码行数:30,代码来源:AppenderSkeleton.java

示例6: decide

public int decide(LoggingEvent event) {
	if (levelMin == null || event.getLevel().isGreaterOrEqual(levelMin))
		return Filter.NEUTRAL;

	String tn = event.getThreadName();

	if (tn == null || regex == null)
		return Filter.NEUTRAL;

	if (tn.matches(regex)) {
		if (getAcceptOnMatch()) {
			return Filter.ACCEPT;
		} else {
			return Filter.DENY;
		}
	} else {
		return Filter.NEUTRAL;
	}
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:19,代码来源:IbisThreadFilter.java

示例7: decide

/**
 *
 * @param event 需进行裁决的loggingEvent
 * @return 裁决结果
 */
public int decide(LoggingEvent event) {
    if (tokenBucket == null) {
        tokenBucket = new TokenBucket(refillAmount, refillInterval,
                maxBurst);
    }

    return tokenBucket.consume() ? Filter.DENY : Filter.NEUTRAL;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:13,代码来源:BurstFilter.java

示例8: decide

@Override
public int decide(final LoggingEvent event) {
  int _xifexpression = (int) 0;
  String _loggerName = event.getLoggerName();
  String _name = this.source.getName();
  boolean _equals = Objects.equal(_loggerName, _name);
  if (_equals) {
    _xifexpression = Filter.DENY;
  } else {
    _xifexpression = Filter.NEUTRAL;
  }
  return _xifexpression;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:13,代码来源:LoggingTester.java

示例9: decide

/**
   Return the decision of this filter.
 */
public
int decide(LoggingEvent event) {
  if(this.levelMin != null) {
    if (event.getLevel().isGreaterOrEqual(levelMin) == false) {
      // level of event is less than minimum
      return Filter.DENY;
    }
  }

  if(this.levelMax != null) {
    if (event.getLevel().toInt() > levelMax.toInt()) {
      // level of event is greater than maximum
      // Alas, there is no Level.isGreater method. and using
      // a combo of isGreaterOrEqual && !Equal seems worse than
      // checking the int values of the level objects..
      return Filter.DENY;
    }
  }

  if (acceptOnMatch) {
    // this filter set up to bypass later filters and always return
    // accept if level in range
    return Filter.ACCEPT;
  }
  else {
    // event is ok for this filter; allow later filters to have a look..
    return Filter.NEUTRAL;
  }
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:32,代码来源:LevelRangeFilter.java

示例10: decide

public int decide(LoggingEvent event) {
    this.msg = (String) event.getMessage();
    if (event.getThrowableInformation() != null && event.getThrowableInformation().getThrowable() != null) {
        this.thrownMsg = event.getThrowableInformation().getThrowable().getMessage();
    }
    return Filter.NEUTRAL;
}
 
开发者ID:Schnitker,项目名称:LogManager,代码行数:7,代码来源:TestLog4j.java

示例11: decide

@Override
public int decide(LoggingEvent event) {
	if(event.getMessage() instanceof String){
		if(StringUtils.isEmpty((String)event.getMessage())){
			return Filter.DENY;
		}
	}
	return Filter.NEUTRAL;
}
 
开发者ID:foundation-runtime,项目名称:logging,代码行数:9,代码来源:EmptyMessageFilter.java


注:本文中的org.apache.log4j.spi.Filter.NEUTRAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。