gpt4 book ai didi

java - Jetty - 如何使 camel 应用程序将事件记录到 hawtio 日志选项卡

转载 作者:行者123 更新时间:2023-11-30 08:58:06 25 4
gpt4 key购买 nike

我有一个简单的 camel 应用程序在计时器上记录事件。日志当前转到 ConsoleAppender。

    <route>
<from uri="timer://hello?period=5000"/>
<to uri="log:loggingstuff?showAll=true"/>
</route>

我已尝试按照以下文档进行操作:http://hawt.io/plugins/logs/

该应用程序部署为 jetty 上的 war ,并具有 log4j、slf4j 和 insight-log4j 作为依赖项。 hawtio-default-1.4.37.war 与它一起部署在 ${jetty.home}/webapps 目录中。 Jetty 以“-Dhawtio.authenticationEnabled=false -Dhawtio.offline=true”开始

    <dependency>
<groupId>io.fabric8.insight</groupId>
<artifactId>insight-log4j</artifactId>
<version>1.2.0.Beta4</version>
</dependency>

并且在 spring camel-context.xml 中有 logQuery bean

<bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
lazy-init="false" scope="singleton"
init-method="start" destroy-method="stop"/>

不幸的是,我没有看到 camel 应用程序生成的日志事件。我看到的唯一事件是:

2015-01-08 15:09:20.026 WARNio.hawt.config.ConfigFacade No ConfigFacade constructed yet so using default configuration for now
2015-01-08 15:09:20.043 INFOio.hawt.git.GitFacade hawtio using config directory: /Users/ohhai/.hawtio/config
2015-01-08 15:09:20.088 INFOio.hawt.git.GitFacade Performing a pull in git repository /Users/ohhai/.hawtio/config on remote URL: https://github.com/hawtio/hawtio-config.git. Subsequent pull attempts will use debug logging
2015-01-08 15:09:21.618 WARNio.hawt.jvm.local.JVMList Local JVM discovery disabled as this JVM cannot access com.sun.tools.attach.VirtualMachine due to: com/sun/tools/attach/VirtualMachine
2015-01-08 15:09:21.621 INFOio.hawt.web.AuthenticationFilter Starting hawtio authentication filter, JAAS authentication disabled

谁能给我一些关于如何让日志显示在“日志”选项卡上的指示?

最佳答案

我刚遇到同样的问题。我解决了它,但不确定它是否是最佳解决方案。

Camel 使用 sfl4j 作为日志外观。 Hawtio 日志插件拦截 Log4J (1.x) 日志记录。确保与 slf4j 一起使用的日志记录包是 log4j 1.x (slf4j-log4j12-x.x.x.jar)。我以前使用过 Log4J 2.x 包,但没有用。使用 Log4J 1.x,它现在运行良好

关于java - Jetty - 如何使 camel 应用程序将事件记录到 hawtio 日志选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27832931/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com