85546

Jetty - How to make a camel application log events to the hawtio Logs tab

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>

I have attempted to follow the documentation as per: http://hawt.io/plugins/logs/

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>

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?

Answer1:

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

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

Answer2:

I'm not entirely sure how I did it - but I managed to get this running - using the log4j 1.x as you have suggested - and also excluding commons-logging from the application build.

Recommend

  • example to deploy docker image on kubernetes from java [closed]
  • PrimeFaces p:fileUpload Listener method is never invoked for mode=“simple”
  • AS3 enemies double speed?
  • Memory usage and time for execution for another process using C#?
  • how to exclude java sources from a third party jar?
  • Is there a way to clear some session data from ALL sessions?
  • Regarding client side code generation from WSDL
  • c# linear regression given 2 sets of data
  • SOAP with Attachment / MIME content
  • how to automatically enter password when using ssh?
  • How can I create one checksum of two files in Maven to use it in the name of a directory
  • How to call BeanFactoryPostProcessor.postProcessBeanFactory method when use Spring with XML configur
  • Recommended way to remove events on destroy with jQuery UI Widget Factory
  • JPA CDI Injecting DAO into an Entity
  • What is the likely cause of a net::ERR_CONNECTION_ABORTED when uploading a file to Spring
  • Why does Sencha 2 only work in Webkit browsers?
  • Create registry key in 32-bit hive on x64 PC using Installshield 2012 LE - Avoid redirection
  • Android Chronometer starts and stops but carries on counting when stopped
  • How to open multiple instances of a program in Linux
  • Configuring multiple DefaultJmslistenercontainerfactory
  • Segmentation Fault on MySQL2 / Ruby 1.9.3 / Rails 3.2
  • If I am creating a simple client server application in IntelliJ, how should this work?
  • Replace last two characters in column
  • Is it possible to define rest argument in OCaml?
  • Ruby on Rails App deployed to heroku showing “We're sorry, but something went wrong”
  • Display validation errors inside
  • How can I replace the server in Web Component Tester
  • Clear activity stack before launching another activity
  • JPA flush vs commit
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • What is the purpose of TaskExecutor in spring?
  • java inputstream
  • Record samples being played with OpenAL
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • Deserializing XML into class C#
  • Numpy divide by zero. Why?
  • How to include full .NET prerequisite for Wix Burn installer
  • costura.fody for a dll that references another dll
  • Converting MP3 duration time
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize