Search in sources :

Example 1 with CamelLogProcessor

use of org.apache.camel.processor.CamelLogProcessor in project camel by apache.

the class LogEndpoint method createLogger.

/**
     * Creates the logger {@link Processor} to be used.
     */
protected Processor createLogger() throws Exception {
    Processor answer;
    // setup a new logger here
    CamelLogger camelLogger;
    LoggingLevel loggingLevel = LoggingLevel.INFO;
    if (level != null) {
        loggingLevel = LoggingLevel.valueOf(level);
    }
    if (providedLogger == null) {
        camelLogger = new CamelLogger(loggerName, loggingLevel, getMarker());
    } else {
        camelLogger = new CamelLogger(providedLogger, loggingLevel, getMarker());
    }
    if (getGroupSize() != null) {
        answer = new ThroughputLogger(camelLogger, getGroupSize());
    } else if (getGroupInterval() != null) {
        Boolean groupActiveOnly = getGroupActiveOnly() != null ? getGroupActiveOnly() : Boolean.TRUE;
        Long groupDelay = getGroupDelay();
        answer = new ThroughputLogger(camelLogger, this.getCamelContext(), getGroupInterval(), groupDelay, groupActiveOnly);
    } else {
        answer = new CamelLogProcessor(camelLogger, localFormatter);
    }
    // the logger is the processor
    setProcessor(answer);
    return answer;
}
Also used : CamelLogger(org.apache.camel.util.CamelLogger) CamelLogProcessor(org.apache.camel.processor.CamelLogProcessor) Processor(org.apache.camel.Processor) LoggingLevel(org.apache.camel.LoggingLevel) CamelLogProcessor(org.apache.camel.processor.CamelLogProcessor) ThroughputLogger(org.apache.camel.processor.ThroughputLogger)

Aggregations

LoggingLevel (org.apache.camel.LoggingLevel)1 Processor (org.apache.camel.Processor)1 CamelLogProcessor (org.apache.camel.processor.CamelLogProcessor)1 ThroughputLogger (org.apache.camel.processor.ThroughputLogger)1 CamelLogger (org.apache.camel.util.CamelLogger)1