ch.qos.logback.classic.spi.LoggerContextVO Java Examples

The following examples show how to use ch.qos.logback.classic.spi.LoggerContextVO. 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: AwsCWEventDump.java    From cloudwatch-logback-appender with Apache License 2.0 6 votes vote down vote up
public void run() {
    List<ILoggingEvent> collections = new LinkedList<ILoggingEvent>();
    LoggerContextVO context = null;
    while(!done) {

        try {
            int[] nbs = queue.drainTo(collections);
            if(context==null && !collections.isEmpty()) {
                context = collections.get(0).getLoggerContextVO();
            }

            int msgProcessed = nbs[0];
            int msgSkipped = nbs[1];
            if(context!=null && msgSkipped>0) {
                collections.add(new SkippedEvent(msgSkipped, context));
            }
            log(collections);
            collections.clear();
        }
        catch(InterruptedException e) {
            // ignoring
        }
    }
}
 
Example #2
Source File: LogbackPropertyValueDiscriminator.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public String getDiscriminatingValue(final ILoggingEvent event)
{
    final LoggerContextVO context = event.getLoggerContextVO();
    if (context != null && context.getPropertyMap() != null && context.getPropertyMap().get(_key) != null)
    {
        return context.getPropertyMap().get(_key);
    }
    return _defaultValue;
}
 
Example #3
Source File: KonkerLoggerContextVO.java    From konker-platform with Apache License 2.0 5 votes vote down vote up
public boolean equals(Object o) {
    if(this == o) {
        return true;
    } else if(!(o instanceof LoggerContextVO)) {
        return false;
    } else {
        KonkerLoggerContextVO that = (KonkerLoggerContextVO) o;
        if(this.birthTime != that.birthTime) {
            return false;
        } else {
            if(this.name != null) {
                if(!this.name.equals(that.name)) {
                    return false;
                }
            } else if(that.name != null) {
                return false;
            }

            if(this.propertyMap != null) {
                if(!this.propertyMap.equals(that.propertyMap)) {
                    return false;
                }
            } else if(that.propertyMap != null) {
                return false;
            }

            return true;
        }
    }
}
 
Example #4
Source File: RequestContextExportingAppender.java    From armeria with Apache License 2.0 5 votes vote down vote up
LoggingEventWrapper(ILoggingEvent event, Map<String, String> mdcPropertyMap) {
    this.event = event;
    this.mdcPropertyMap = mdcPropertyMap;

    final LoggerContextVO oldVo = event.getLoggerContextVO();
    if (oldVo != null) {
        vo = new LoggerContextVO(oldVo.getName(), mdcPropertyMap, oldVo.getBirthTime());
    } else {
        vo = null;
    }
}
 
Example #5
Source File: SkippedEvent.java    From cloudwatch-logback-appender with Apache License 2.0 4 votes vote down vote up
public SkippedEvent(int aMessages, LoggerContextVO aLoggerContextV0) {
    no = aMessages;
    loggerContextVO = aLoggerContextV0;
}
 
Example #6
Source File: SkippedEvent.java    From cloudwatch-logback-appender with Apache License 2.0 4 votes vote down vote up
@Override
public LoggerContextVO getLoggerContextVO() {
    return loggerContextVO;
}
 
Example #7
Source File: ExpectedExceptionAppender.java    From centraldogma with Apache License 2.0 4 votes vote down vote up
@Override
public LoggerContextVO getLoggerContextVO() {
    return event.getLoggerContextVO();
}
 
Example #8
Source File: MetricsLogAppenderTests.java    From pravega with Apache License 2.0 4 votes vote down vote up
@Override
public LoggerContextVO getLoggerContextVO() {
    return null;
}
 
Example #9
Source File: LoggingServletTest.java    From baleen with Apache License 2.0 4 votes vote down vote up
private ILoggingEvent createEvent(String message) {
  return new ILoggingEvent() {

    @Override
    public void prepareForDeferredProcessing() {
      // Do nothing
    }

    @Override
    public boolean hasCallerData() {
      return false;
    }

    @Override
    public long getTimeStamp() {
      return 0;
    }

    @Override
    public IThrowableProxy getThrowableProxy() {
      return null;
    }

    @Override
    public String getThreadName() {
      return "test";
    }

    @Override
    public String getMessage() {
      return message;
    }

    @Override
    public Map<String, String> getMdc() {
      return Collections.emptyMap();
    }

    @Override
    public Marker getMarker() {
      return null;
    }

    @Override
    public Map<String, String> getMDCPropertyMap() {
      return Collections.emptyMap();
    }

    @Override
    public String getLoggerName() {
      return "fake";
    }

    @Override
    public LoggerContextVO getLoggerContextVO() {
      return null;
    }

    @Override
    public Level getLevel() {
      return Level.INFO;
    }

    @Override
    public String getFormattedMessage() {
      return message;
    }

    @Override
    public StackTraceElement[] getCallerData() {
      return new StackTraceElement[0];
    }

    @Override
    public Object[] getArgumentArray() {
      return new Object[0];
    }
  };
}
 
Example #10
Source File: RequestContextExportingAppender.java    From armeria with Apache License 2.0 4 votes vote down vote up
@Override
@Nullable
public LoggerContextVO getLoggerContextVO() {
    return vo;
}