本文整理了Java中org.apache.log4j.spi.Filter.decide()
方法的一些代码示例,展示了Filter.decide()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Filter.decide()
方法的具体详情如下:
包路径:org.apache.log4j.spi.Filter
类名称:Filter
方法名:decide
[英]If the decision is DENY
, then the event will be dropped. If the decision is NEUTRAL
, then the next filter, if any, will be invoked. If the decision is ACCEPT then the event will be logged without consulting with other filters in the chain.
[中]如果决策为DENY
,则事件将被删除。如果决策为NEUTRAL
,则将调用下一个筛选器(如果有)。如果决定为“接受”,则将记录事件,而无需咨询链中的其他筛选器。
代码示例来源:origin: log4j/log4j
/**
* 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);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* 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);
}
代码示例来源:origin: apache/log4j
/**
* 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);
}
代码示例来源:origin: org.ops4j.pax.logging/pax-logging-service
/**
* If this event does not already contain location information,
* evaluate the event against the expression.
*
* If the expression evaluates to true, generate a LocationInfo instance
* by creating an exception and set this LocationInfo on the event.
*
* Returns {@link Filter#NEUTRAL}
*/
public int decide(final LoggingEvent event) {
boolean accepted = true;
Filter f = headFilter;
while (f != null) {
accepted = accepted && (Filter.ACCEPT == f.decide(event));
f = f.next;
}
if (accepted) {
if(acceptOnMatch) {
return Filter.ACCEPT;
}
return Filter.DENY;
}
return Filter.NEUTRAL;
}
代码示例来源:origin: org.ops4j.pax.logging/pax-logging-service
/**
* {@inheritDoc}
*/
public boolean isTriggeringEvent(LoggingEvent event) {
//
// in the abnormal case of no contained filters
// always return true to avoid each logging event
// from having its own file.
if (headFilter == null) {
return false;
}
//
// otherwise loop through the filters
//
for (Filter f = headFilter; f != null; f = f.next) {
switch (f.decide(event)) {
case Filter.DENY:
return false;
case Filter.ACCEPT:
return true;
}
}
return true;
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
/**
* If this event does not already contain location information,
* evaluate the event against the expression.
*
* If the expression evaluates to true, generate a LocationInfo instance
* by creating an exception and set this LocationInfo on the event.
*
* Returns {@link Filter#NEUTRAL}
*/
public int decide(final LoggingEvent event) {
boolean accepted = true;
Filter f = headFilter;
while (f != null) {
accepted = accepted && (Filter.ACCEPT == f.decide(event));
f = f.next;
}
if (accepted) {
if(acceptOnMatch) {
return Filter.ACCEPT;
}
return Filter.DENY;
}
return Filter.NEUTRAL;
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
/**
* {@inheritDoc}
*/
public boolean isTriggeringEvent(LoggingEvent event) {
//
// in the abnormal case of no contained filters
// always return true to avoid each logging event
// from having its own file.
if (headFilter == null) {
return false;
}
//
// otherwise loop through the filters
//
for (Filter f = headFilter; f != null; f = f.next) {
switch (f.decide(event)) {
case Filter.DENY:
return false;
case Filter.ACCEPT:
return true;
}
}
return true;
}
代码示例来源:origin: org.ops4j.pax.logging/pax-logging-service
public int decide(LoggingEvent event)
{
PaxFilter filter = (PaxFilter) m_tracker.getService();
if (filter != null)
{
return filter.doFilter( new PaxLoggingEventImpl( event ) );
}
return m_fallback.decide( event );
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
public int decide(LoggingEvent event)
{
PaxFilter filter = (PaxFilter) m_tracker.getService();
if (filter != null)
{
return filter.doFilter( new PaxLoggingEventImpl( event ) );
}
return m_fallback.decide( event );
}
代码示例来源:origin: org.jboss.logmanager/log4j-jboss-logmanager
public boolean isLoggable(final LogRecord record) {
final ExtLogRecord extRec = ExtLogRecord.wrap(record);
Filter filter = filterChain;
while (filter != null) {
final int result = filter.decide(new LoggingEvent(extRec, Logger.getLogger(record.getLoggerName())));
switch (result) {
case Filter.DENY: return false;
case Filter.ACCEPT: return true;
}
filter = filter.getNext();
}
return defaultResult;
}
}
代码示例来源:origin: org.ops4j.pax.logging/pax-logging-service
public 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);
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
public 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);
}
代码示例来源:origin: org.ops4j.pax.logging/pax-logging-service
public 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);
}
代码示例来源:origin: org.jboss.logmanager/jboss-logmanager-log4j
/**
* Determine if the record is loggable.
*
* @param record the log record
* @return {@code true} if it is loggable
*/
public boolean isLoggable(final LogRecord record) {
final ExtLogRecord extRec = ExtLogRecord.wrap(record);
Filter filter = filterChain;
while (filter != null) {
final int result = filter.decide(new ConvertedLoggingEvent(extRec));
switch (result) {
case Filter.DENY: return false;
case Filter.ACCEPT: return true;
}
filter = filter.getNext();
}
return defaultResult;
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
/**
* 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);
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
public 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);
}
代码示例来源:origin: apache-log4j/log4j
/**
* 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);
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* 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);
}
代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j
/**
* 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);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.log4j
/**
* 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);
}
内容来源于网络,如有侵权,请联系作者删除!