本文整理汇总了Java中org.apache.camel.LoggingLevel.INFO属性的典型用法代码示例。如果您正苦于以下问题:Java LoggingLevel.INFO属性的具体用法?Java LoggingLevel.INFO怎么用?Java LoggingLevel.INFO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.camel.LoggingLevel
的用法示例。
在下文中一共展示了LoggingLevel.INFO属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
@Override
public Optional<ProcessorDefinition> handle(Log step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) {
LoggingLevel loggingLevel = LoggingLevel.INFO;
if (step.getLoggingLevel() != null) {
loggingLevel = LoggingLevel.valueOf(step.getLoggingLevel());
}
return Optional.of(route.log(loggingLevel, step.getLogger(), step.getMarker(), step.getMessage()));
}
示例2: handle
@Override
public ProcessorDefinition handle(Log item, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) {
Log step = item;
LoggingLevel loggingLevel = LoggingLevel.INFO;
if (step.getLoggingLevel() != null) {
loggingLevel = LoggingLevel.valueOf(step.getLoggingLevel());
}
return route.log(loggingLevel, step.getLogger(), step.getMarker(), step.getMessage());
}
示例3: run
/**
* Invoked whenever we should be polled
*/
public void run() {
// avoid this thread to throw exceptions because the thread pool wont re-schedule a new thread
try {
// log starting
if (LoggingLevel.ERROR == runLoggingLevel) {
LOG.error("Scheduled task started on: {}", this.getEndpoint());
} else if (LoggingLevel.WARN == runLoggingLevel) {
LOG.warn("Scheduled task started on: {}", this.getEndpoint());
} else if (LoggingLevel.INFO == runLoggingLevel) {
LOG.info("Scheduled task started on: {}", this.getEndpoint());
} else if (LoggingLevel.DEBUG == runLoggingLevel) {
LOG.debug("Scheduled task started on: {}", this.getEndpoint());
} else {
LOG.trace("Scheduled task started on: {}", this.getEndpoint());
}
// execute scheduled task
doRun();
// log completed
if (LoggingLevel.ERROR == runLoggingLevel) {
LOG.error("Scheduled task completed on: {}", this.getEndpoint());
} else if (LoggingLevel.WARN == runLoggingLevel) {
LOG.warn("Scheduled task completed on: {}", this.getEndpoint());
} else if (LoggingLevel.INFO == runLoggingLevel) {
LOG.info("Scheduled task completed on: {}", this.getEndpoint());
} else if (LoggingLevel.DEBUG == runLoggingLevel) {
LOG.debug("Scheduled task completed on: {}", this.getEndpoint());
} else {
LOG.trace("Scheduled task completed on: {}", this.getEndpoint());
}
} catch (Error e) {
// must catch Error, to ensure the task is re-scheduled
LOG.error("Error occurred during running scheduled task on: " + this.getEndpoint() + ", due: " + e.getMessage(), e);
}
}
示例4: logTransactionCommit
/**
* Logs the transaction commit
*/
private void logTransactionCommit(String redelivered, String ids) {
if ("true".equals(redelivered)) {
// okay its a redelivered message so log at INFO level if rollbackLoggingLevel is INFO or higher
// this allows people to know that the redelivered message was committed this time
if (rollbackLoggingLevel == LoggingLevel.INFO || rollbackLoggingLevel == LoggingLevel.WARN || rollbackLoggingLevel == LoggingLevel.ERROR) {
log.info("Transaction commit ({}) redelivered({}) for {})", new Object[]{transactionKey, redelivered, ids});
// return after we have logged
return;
}
}
// log non redelivered by default at DEBUG level
log.debug("Transaction commit ({}) redelivered({}) for {})", new Object[]{transactionKey, redelivered, ids});
}
示例5: logTransactionRollback
/**
* Logs the transaction rollback.
*/
private void logTransactionRollback(String redelivered, String ids, Throwable e, boolean rollbackOnly) {
if (rollbackLoggingLevel == LoggingLevel.OFF) {
return;
} else if (rollbackLoggingLevel == LoggingLevel.ERROR && log.isErrorEnabled()) {
if (rollbackOnly) {
log.error("Transaction rollback ({}) redelivered({}) for {} due exchange was marked for rollbackOnly", new Object[]{transactionKey, redelivered, ids});
} else {
log.error("Transaction rollback ({}) redelivered({}) for {} caught: {}", new Object[]{transactionKey, redelivered, ids, e.getMessage()});
}
} else if (rollbackLoggingLevel == LoggingLevel.WARN && log.isWarnEnabled()) {
if (rollbackOnly) {
log.warn("Transaction rollback ({}) redelivered({}) for {} due exchange was marked for rollbackOnly", new Object[]{transactionKey, redelivered, ids});
} else {
log.warn("Transaction rollback ({}) redelivered({}) for {} caught: {}", new Object[]{transactionKey, redelivered, ids, e.getMessage()});
}
} else if (rollbackLoggingLevel == LoggingLevel.INFO && log.isInfoEnabled()) {
if (rollbackOnly) {
log.info("Transaction rollback ({}) redelivered({}) for {} due exchange was marked for rollbackOnly", new Object[]{transactionKey, redelivered, ids});
} else {
log.info("Transaction rollback ({}) redelivered({}) for {} caught: {}", new Object[]{transactionKey, redelivered, ids, e.getMessage()});
}
} else if (rollbackLoggingLevel == LoggingLevel.DEBUG && log.isDebugEnabled()) {
if (rollbackOnly) {
log.debug("Transaction rollback ({}) redelivered({}) for {} due exchange was marked for rollbackOnly", new Object[]{transactionKey, redelivered, ids});
} else {
log.debug("Transaction rollback ({}) redelivered({}) for {} caught: {}", new Object[]{transactionKey, redelivered, ids, e.getMessage()});
}
} else if (rollbackLoggingLevel == LoggingLevel.TRACE && log.isTraceEnabled()) {
if (rollbackOnly) {
log.trace("Transaction rollback ({}) redelivered({}) for {} due exchange was marked for rollbackOnly", new Object[]{transactionKey, redelivered, ids});
} else {
log.trace("Transaction rollback ({}) redelivered({}) for {} caught: {}", new Object[]{transactionKey, redelivered, ids, e.getMessage()});
}
}
}
示例6: createProcessor
@Override
public Processor createProcessor(RouteContext routeContext) throws Exception {
ObjectHelper.notEmpty(message, "message", this);
// use simple language for the message string to give it more power
Expression exp = routeContext.getCamelContext().resolveLanguage("simple").createExpression(message);
// get logger explicitely set in the definition
Logger logger = this.getLogger();
// get logger which may be set in XML definition
if (logger == null && ObjectHelper.isNotEmpty(loggerRef)) {
logger = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), loggerRef, Logger.class);
}
if (logger == null) {
// first - try to lookup single instance in the registry, just like LogComponent
Map<String, Logger> availableLoggers = routeContext.lookupByType(Logger.class);
if (availableLoggers.size() == 1) {
logger = availableLoggers.values().iterator().next();
LOG.debug("Using custom Logger: {}", logger);
} else if (availableLoggers.size() > 1) {
// we should log about this somewhere...
LOG.debug("More than one {} instance found in the registry. Falling back to create logger by name.", Logger.class.getName());
}
}
if (logger == null) {
String name = getLogName();
if (name == null) {
name = routeContext.getCamelContext().getProperty(Exchange.LOG_EIP_NAME);
if (name != null) {
LOG.debug("Using logName from CamelContext properties: {}", name);
}
}
if (name == null) {
name = routeContext.getRoute().getId();
LOG.debug("LogName is not configured, using route id as logName: {}", name);
}
logger = LoggerFactory.getLogger(name);
}
// should be INFO by default
LoggingLevel level = getLoggingLevel() != null ? getLoggingLevel() : LoggingLevel.INFO;
CamelLogger camelLogger = new CamelLogger(logger, level, getMarker());
return new LogProcessor(exp, camelLogger);
}
示例7: CamelLogger
public CamelLogger(Logger log) {
this(log, LoggingLevel.INFO);
}