Help using Chainsaw for Log4j

J

jerry

Newbie questions. Can someone help?

I'm trying to figure out how to use Chainsaw. I've been using log4j for
a couple of years, but I'm now trying to figure out how to use Chainsaw
(V.2). Do you need to have a log4j.properties AND a log4j.xml file ? I
having trouble distinguishing between receiver files and log4j files.
Which starts first the application or Chainsaw or does it matter.
Any quick start information would be appreciated.
 
S

scott

Hi Jerry,

Chainsaw needs a log4j config file (log4j.xml or log4j.properties) to
configure receivers, similar to how you configure appenders.

Here's a link to an example receiver configuration:

http://cvs.apache.org/viewcvs.cgi/l...w/log4j-receiver-sample.xml?rev=1.4&view=auto

Save this file to somewhere on your file system after modifying the
'plugin' (receiver) configurations that match the appenders you use (if
you use a socketappender, configure a socketreceiver to use the same
port).

Then, open Chainsaw (available via Web Start here):
http://logging.apache.org/log4j/docs/chainsaw.html
From inside Chainsaw, select the view-show application wide preferences
menu.

Specify the URL to the log4j receiver config file you created in the
'automatic configuration URL' field, hit OK and restart Chainsaw.

The same receiver configuration example is available from the 'Welcome'
tab - select the 'View example receiver configuration' button on the
Welcome tab's toolbar.

You can also create receivers dynamically from the receiver panel - be
sure to specify the 'name' field or you you won't be able to find it in
the receiver list later.

There is a tutorial available from the Welcome tab explaining the main
features of Chainsaw.

If you have more questions feel free to send an email to the log4j user
mailing list: http://logging.apache.org/site/mailing-lists.html

Hope this helps,

Scott
 
J

jerry

Scott, Thanks for the reply, but I'm still not quite getting it.

Currently, we are using something like this for Log4J. I've used it
unsuccessfully with Chainsaw. How does this covert into XML (like the
example that you provided) ? Thank you.

log4j.rootCategory=DEBUG, A2, Chainsaw

log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-5p [%F %L] - %m%n

log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A2.file=C:/logs/log4j.log
log4j.appender.A2.datePattern='.'yyyy-MM-dd
log4j.appender.A2.append=true
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%-5p %d{ISO8601} [%F %L] -
%m%n

#log4j.appender.A2=org.apache.log4j.FileAppender
#log4j.appender.A2.file=C:/logs/log4j.log
#log4j.appender.A2.layout=org.apache.log4j.xml.XMLLayout
#log4j.appender.A2.append=false


#log4j.appender.Chainsaw=org.apache.log4j.net.SocketAppender
#log4j.appender.Chainsaw.remoteHost=localhost
#log4j.appender.Chainsaw.port=4445
#log4j.appender.Chainsaw.locationInfo=true
 
S

sdeboyx

A couple of things: you can't display location info in Chainsaw V2 if
you're not using log4j 1.3 (alpha) on the appender side (probably the
case - if you're using log4j 1.2.9 or earlier).

Here's what you need to do to your log4j.properties file:
-uncomment the chainsaw appender section
-remove this line: log4j.appender.Chainsaw.locationInfo=true

The sample config file I linked to is set up to receive events on port
4445 (the SocketReceiver section of the xml file), so the directions I
listed should work fine.

- copy the link to the sample receiver config to your file system
http://cvs.apache.org/viewcvs.cgi/l...w/log4j-receiver-sample.xml?rev=1.4&view=auto

- save this file to somewhere on your file system
- open Chainsaw (available via Web Start here):
http://logging.apache.org/log4j/docs/chainsaw.html

- from inside Chainsaw, select the view-show application wide
preferences menu.

Specify the URL to the log4j receiver config file you created in the
'automatic configuration URL' field, hit OK and restart Chainsaw.
The url should look like this:
file:///c:/mypath/log4j-receiver-sample.xml

Hope that helps
Scott

Scott, Thanks for the reply, but I'm still not quite getting it.

Currently, we are using something like this for Log4J. I've used it
unsuccessfully with Chainsaw. How does this covert into XML (like the
example that you provided) ? Thank you.

log4j.rootCategory=DEBUG, A2, Chainsaw

log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-5p [%F %L] - %m%n

log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A2.file=C:/logs/log4j.log
log4j.appender.A2.datePattern='.'yyyy-MM-dd
log4j.appender.A2.append=true
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%-5p %d{ISO8601} [%F %L] -
%m%n

#log4j.appender.A2=org.apache.log4j.FileAppender
#log4j.appender.A2.file=C:/logs/log4j.log
#log4j.appender.A2.layout=org.apache.log4j.xml.XMLLayout
#log4j.appender.A2.append=false


#log4j.appender.Chainsaw=org.apache.log4j.net.SocketAppender
#log4j.appender.Chainsaw.remoteHost=localhost
#log4j.appender.Chainsaw.port=4445
#log4j.appender.Chainsaw.locationInfo=true


Hi Jerry,

Chainsaw needs a log4j config file (log4j.xml or log4j.properties) to
configure receivers, similar to how you configure appenders.

Here's a link to an example receiver configuration:
http://cvs.apache.org/viewcvs.cgi/l...w/log4j-receiver-sample.xml?rev=1.4&view=auto
Save this file to somewhere on your file system after modifying the
'plugin' (receiver) configurations that match the appenders you use (if
you use a socketappender, configure a socketreceiver to use the same
port).

Then, open Chainsaw (available via Web Start here):
http://logging.apache.org/log4j/docs/chainsaw.html
preferences
menu.

Specify the URL to the log4j receiver config file you created in the
'automatic configuration URL' field, hit OK and restart Chainsaw.

The same receiver configuration example is available from the 'Welcome'
tab - select the 'View example receiver configuration' button on the
Welcome tab's toolbar.

You can also create receivers dynamically from the receiver panel - be
sure to specify the 'name' field or you you won't be able to find
it
in
the receiver list later.

There is a tutorial available from the Welcome tab explaining the main
features of Chainsaw.

If you have more questions feel free to send an email to the log4j user
mailing list: http://logging.apache.org/site/mailing-lists.html

Hope this helps,

Scott
log4j
for
file
 
Joined
Sep 12, 2011
Messages
1
Reaction score
0
Socket Receiver/Socket Appender

Hi,


1. Following is how my SocketAppender configured.


<appender name="SOCKET1" class="org.apache.log4j.net.SocketAppender">
<param name="Port" value="12346"/>
<param name="RemoteHost" value="localhost"/>
<param name="ReconnectionDelay" value="60000"/>
<param name="Threshold" value="ALL"/>
</appender>



2. Following is how my SocketReceiver is configured.


<plugin name="MyReceiver1" class="org.apache.log4j.net.SocketReceiver">
< <param name="Port" value="12346" />
< <param name="name" value="Server-1" />
< <param name="Threshold" value="ALL" />
</plugin>


By this in chainsaw I am getting a Tabbed Pane with name as “localhost-“, but what I am looking for is a Tabbed Pane with name “localhost-AppName”.

Please let me know what changes should I do to get, Tabbed Pane name as “localhost-AppName”.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top