Jetty - 如何将骆驼应用程序日志事件记录到 hawtio 日志选项卡 [英] Jetty - How to make a camel application log events to the hawtio Logs tab

查看:33
本文介绍了Jetty - 如何将骆驼应用程序日志事件记录到 hawtio 日志选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a simple camel application logging events on a timer. The logs currently go to a ConsoleAppender.

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

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

I have attempted to follow the documentation as per: 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"开头

The application is deployed as a war on jetty, and has log4j, slf4j and insight-log4j as dependencies. hawtio-default-1.4.37.war is deployed alongside it in the ${jetty.home}/webapps directory. Jetty is started with "-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

and has the logQuery bean in the spring camel-context.xml

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

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

Unfortunately I am not seeing the log events generated from the camel application. The only events I see are:

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

谁能给我一些有关如何在日志"选项卡上显示日志的提示?

Can anyone give me some pointers on how to get the logging displaying on the Logs Tab?

推荐答案

我刚刚遇到了同样的问题.我解决了它,但不确定这是最好的解决方案.

I've just run into same problem. I resolved it but not sure it's the best solution.

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

Camel uses sfl4j as logging facade. Hawtio log plugin intercepts Log4J (1.x) logging. Make sure the logging bundle you use with slf4j is log4j 1.x (slf4j-log4j12-x.x.x.jar). I used Log4J 2.x bundle before and was not working. With Log4J 1.x it works well now

这篇关于Jetty - 如何将骆驼应用程序日志事件记录到 hawtio 日志选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆