I use FuseSource distribution of Servicemix (aka Fuse ESB.
You can download Fuse ESB here:
I was able to visualize the Servicemix logs inside the
Chainsaw GUI using the following steps:
1) Install
Chainsaw.
Download the latest distribution of chainsaw.
I downloaded the “Unix/Dos standalone version”
Extract to location of choice.
2) Configure
Chainsaw to listen for logging events on a given port.
Into the directory where I extracted chainsaw, I created a
file “chainsaw-config.xml” with the following contents.
<?xml version="1.0" encoding="UTF-8"
?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
<plugin
name="SocketReceiver"
class="org.apache.log4j.net.SocketReceiver">
<param
name="Port" value="4445"/>
</plugin>
<root>
<level
value="debug"/>
</root>
</log4j:configuration>
The above configures chainsaw with a SocketReceiver that
will listen on port 4445 to receive logging events.
3) Configure
Servicemix to send logging events.
Now to configure Servicemix to
send logging event to this port you will update the Servicemix configuration.
Edit the config file ‘org.ops4j.pax.logging.cfg’. Use the following as a guide
for editing this file:
# the below line is an ‘edit’ of
exising line – added a Chainsaw appender
log4j.rootLogger = INFO, sift,
Chainsaw, osgi:VmLogAppender
…
# the below are completely new
lines to configure the Chainsaw appender
log4j.appender.Chainsaw =
org.apache.log4j.net.SocketAppender
log4j.appender.Chainsaw.remoteHost
= localhost
log4j.appender.Chainsaw.port =
4560
Make sure the “remoteHost” is the
IP for the machine where you are running Chainsaw (or localhost) if you plan to
run Chainsaw GUI on same box as Servicemix. Once you save this file the changes
will take effect immediately, should be no need to restart Servicemix.
You may see Servicemix complain
about not being able to find a receiver for its events. That’s because you
don’t have Chainsaw up yet. Don’t worry Servicemix will retry again once you
stand up the Chainsaw GUI.
4) Bring
up Chainsaw
From the directory where you
installed chainsaw, run the file ‘chainsaw.bat’.
When you start first time it will
give you a warning about not having Receivers defined. You can select “Let me
use a simple Receiver:” and select “SocketReceiver” on port “4560 (Default
SocketAppender port.)”
5) View
the logs in Chainsaw
Since we are experimenting, you may
want to turn up the logs in Servicemix to prove all the logs are reaching
Chainsaw.
From the Servicemix console type:
log:set DEBUG root
This will turn up the logging to
highest level.
Once Servicemix sends an event. You
will eventually see a tab pop up in Chainsaw that contains the logs it receives
from the Servicemix instance. You should see quite a bit of logging being
displayed in Chainsaw.
log:set INFO root
I'm not totally convinced yet whether this will be a useful capability. I'm open to suggestions on how this might be used, or whether people are using this sort of thing at all. I'm a little disappointed in the overall model, that is Servicemix must be configured to send logs to Chainsaw.
One follow up..
ReplyDeleteThe more i think about this model for how chainsaw receives logging events, the less i see usefulness for it.
The model where servicemix connects to chainsaw and and sends data, seems backwards to me. You configure servicemix to point to an instance of chainsaw. That means for every chainsaw (remote listener), we have to configure another host/port in Servicemix to send events to that instance of chainsaw.
I think a superior model would be from chainsaw, you configure chainsaw to connect to some logging server "hub" and receive LoggingEvents. Thats basically what SockerHubAppender does, it creates an effective logging server, letting you connect to it and receive. Now if we could get servicemix to create a SocketHubAppender and then and then configure chainsaw to connect to Servicemix (to begin receiving logging events) - that would be a model i could live with! Or even if we had a single "hub" instance of chainsaw (aka logging server) and remote chainsaw instances could connect to the hub.
Seems like this was also part of the thinking in whats referred to here:
http://wiki.apache.org/logging-log4j/SocketHubAppender
and implemented in chainsaw here.
http://marc.info/?l=log4j-dev&m=102511373124806&w=2
all this is apparently experimental stuff though.
If anyone has experience in this area, would love to here!