How to start using Chainsaw for Log4j?
Asked Answered
P

3

6

I'd like to start using Chainsaw v2. There is almost no information about it. I've found only this , but links cannot be opened, so it isn't clear.

I use socketAppender:

log4j.rootLogger=DEBUG, server

log4j.appender.server=org.apache.log4j.net.SocketAppender
log4j.appender.server.Port=4712
log4j.appender.server.RemoteHost=localhost
log4j.appender.server.ReconnectionDelay=10000

I created file log4j.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
   <appender name="A2" class="org.apache.log4j.ConsoleAppender">
      <layout class="org.apache.log4j.SimpleLayout"/>
   </appender>

   <plugin name="SocketReceiver" class="org.apache.log4j.net.SocketReceiver">
      <param name="Port" value="4712"/>
   </plugin>

   <root>
      <level value="debug"/>
   </root>
</log4j:configuration>

And selected it in let me search for configuration file. But there are no logs. What should I do next?

Pond answered 3/8, 2012 at 7:7 Comment(0)
A
2

I'm one of the Chainsaw authors. Try the latest developer snapshot of Chainsaw, which will be released soon. It has a new configuration UI which should make it much easier to configure, particularly if all you're doing is using a socket appender.

There are a ton of new features in this version. Feel free to email with questions or post to the log4j-user mailing list.

Developer snapshot available here: http://people.apache.org/~sdeboy

Scott

Aliquant answered 3/8, 2012 at 21:40 Comment(1)
Please release v2.1!Polley
S
0

Please use only one file log4j.properties or log4j.xml.And check this article for Chainsaw. It may be helpful to you.

This is sample log4j.properties file for Chainsaw,

  log4j.rootCategory=DEBUG, zeroconf, chainsaw
  # Socket Appender
  log4j.appender.chainsaw=org.apache.log4j.net.SocketAppender
  log4j.appender.chainsaw.remoteHost=localhost
  log4j.appender.chainsaw.port=4445
  log4j.appender.chainsaw.locationInfo=true
Siemens answered 3/8, 2012 at 8:40 Comment(2)
How is it possible to use only one file? First is to configure Logger, second to configure ChainSaw. Could you explain in more details?Pond
I still have some problems. In my program I set PropertyConfigurator.configure("log4j.properties"); and when I start chainsaw I also can choose a file. Is it the same file?Pond
F
0

start server first means in chainsaw log server receiver you can select first socket receiver.

log4j.rootLogger=DEBUG, CHAINSAW_CLIENT

log4j.appender.CHAINSAW_CLIENT=org.apache.log4j.net.SocketAppender log4j.appender.CHAINSAW_CLIENT.RemoteHost=localhost log4j.appender.CHAINSAW_CLIENT.Port=4445
log4j.appender.CHAINSAW_CLIENT.LocationInfo=true

Fascia answered 4/12, 2014 at 12:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.