本文整理汇总了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);
}
示例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);
}
示例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;
}
}
示例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;
}
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}