The idea of using SocketHubAppender was very helpful, in theory for what I want, but I'm having trouble getting it to work. Logging is working fine to stdout and weblog, but chainsaw doesn't see anything. It doesn't even create a tab for the receiver.

Here's my log4j config file:
log4j.rootCategory=INFO, stdout, weblog , chainsaw
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{DATE} [%c{2}]: %-5p:%x %m%n

log4j.appender.weblog=org.apache.log4j.RollingFileAppender
log4j.appender.weblog.File=C:/jakarta-tomcat-4.1.24/webapps/Root/logs/ROOTlog4j.html
log4j.appender.weblog.MaxBackupIndex=100
log4j.appender.weblog.layout=org.apache.log4j.HTMLLayout

log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=C:/jakarta-tomcat-4.1.24/logs/log4jROOT.log
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.MaxBackupIndex=100
log4j.appender.R.layout.ConversionPattern=%d{DATE} [%c{1}]: %-5p:%x %m%n

log4j.appender.chainsaw=org.apache.log4j.net.SocketHubAppender
log4j.appender.chainsaw.Port=7449

Here's my chainsaw config file:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"; debug="true">

<plugin name="Extract Receiver" class="org.apache.log4j.net.SocketReceiver">
 <param name="Port" value="4560" />
 <level value="info" />
</plugin>

<plugin name="PL-LMD Receiver" class="org.apache.log4j.net.SocketHubReceiver">
 <param name="Host" value="localhost" />
 <param name="Port" value="7449" />
 <param name="reconnectionDelay" value="30000" />
 <level value="info" />
</plugin>

<root>
<level value="debug" />
</root>

</log4j:configuration>

Here's the last few entries in my Chainsaw log file:
<log4j:event logger="org.apache.log4j.net.SocketHubReceiver" timestamp="1131136854624" sequenceNumber="73" level="DEBUG" thread="Thread-18">
<log4j:message><![CDATA[Starting a new connector thread.]]></log4j:message>
<log4j:properties>
  <log4j:data name="application" value="log"/>
  <log4j:data name="hostname" value="chainsaw"/>
  <log4j:data name="log4jid" value="47"/>
</log4j:properties>
</log4j:event>

<log4j:event logger="org.apache.log4j.net.SocketHubReceiver" timestamp="1131136854624" sequenceNumber="74" level="DEBUG" thread="Thread-18"> <log4j:message><![CDATA[waiting for 30000 milliseconds before reconnecting.]]></log4j:message>
<log4j:properties>
  <log4j:data name="application" value="log"/>
  <log4j:data name="hostname" value="chainsaw"/>
  <log4j:data name="log4jid" value="48"/>
</log4j:properties>
</log4j:event>

<log4j:event logger="org.apache.log4j.net.SocketHubReceiver" timestamp="1131136884627" sequenceNumber="75" level="DEBUG" thread="Thread-18"> <log4j:message><![CDATA[Attempting connection to localhost]]></log4j:message>
<log4j:properties>
  <log4j:data name="application" value="log"/>
  <log4j:data name="hostname" value="chainsaw"/>
  <log4j:data name="log4jid" value="49"/>
</log4j:properties>
</log4j:event>

<log4j:event logger="org.apache.log4j.net.SocketHubReceiver" timestamp="1131136885278" sequenceNumber="76" level="DEBUG" thread="Thread-18"> <log4j:message><![CDATA[Connection established. Exiting connector thread.]]></log4j:message>
<log4j:properties>
  <log4j:data name="application" value="log"/>
  <log4j:data name="hostname" value="chainsaw"/>
  <log4j:data name="log4jid" value="50"/>
</log4j:properties>
</log4j:event>

<log4j:event logger="org.apache.log4j.net.SocketHubReceiver" timestamp="1131136892378" sequenceNumber="77" level="DEBUG" thread="Thread-18">
<log4j:message><![CDATA[Starting a new connector thread.]]></log4j:message>
<log4j:properties>
  <log4j:data name="application" value="log"/>
  <log4j:data name="hostname" value="chainsaw"/>
  <log4j:data name="log4jid" value="51"/>
</log4j:properties>
</log4j:event>

<log4j:event logger="org.apache.log4j.net.SocketHubReceiver" timestamp="1131136892688" sequenceNumber="78" level="DEBUG" thread="Thread-18"> <log4j:message><![CDATA[waiting for 30000 milliseconds before reconnecting.]]></log4j:message>
<log4j:properties>
  <log4j:data name="application" value="log"/>
  <log4j:data name="hostname" value="chainsaw"/>
  <log4j:data name="log4jid" value="52"/>
</log4j:properties>
</log4j:event>

<log4j:event logger="org.apache.log4j.net.SocketHubReceiver" timestamp="1131136922691" sequenceNumber="79" level="DEBUG" thread="Thread-18"> <log4j:message><![CDATA[Attempting connection to localhost]]></log4j:message>
<log4j:properties>
  <log4j:data name="application" value="log"/>
  <log4j:data name="hostname" value="chainsaw"/>
  <log4j:data name="log4jid" value="53"/>
</log4j:properties>
</log4j:event>

<log4j:event logger="org.apache.log4j.net.SocketHubReceiver" timestamp="1131136922732" sequenceNumber="80" level="DEBUG" thread="Thread-18"> <log4j:message><![CDATA[Connection established. Exiting connector thread.]]></log4j:message>
<log4j:properties>
  <log4j:data name="application" value="log"/>
  <log4j:data name="hostname" value="chainsaw"/>
  <log4j:data name="log4jid" value="54"/>
</log4j:properties>
</log4j:event>

I can telnet to port 7449 and get a connection, but I can't figure out what is happening.
Any ideas?

Any help is appreciated,

Bill

Scott Deboy wrote:

SocketReceiver just needs a port to listen on - it's accepting
connections on a port.  SocketAppender is told the host and port of the
SocketReceiver - the appender connects to the receiver and sends events.
If you change the 'remoteHost' param in your appender config to the IP
address of the machine running Chainsaw it will work (your Chainsaw
receiver config is fine).

I forgot one appender/receiver combination that would probably be more
useful in your case: SocketHubAppender and SocketHubReceiver

The difference between SocketAppender/Receiver and
SocketHubAppender/Receiver:

With SocketAppender and SocketReceiver, the -appender- connects to the
receiver - the appender can only send events to the single client
running the socketreceiver

With SocketHubAppender and SocketHubReceiver, this is reversed: the
-receiver- connects to the appender - so you can run Chainsaw from any
number of clients and connect to the server running a SocketHubAppender

Try out SocketHubAppender and Receiver, and more than one person can
view the events at the same time, without changing your server
configuration.

Hope this helps,
Scott
-----Original Message-----
From: Rakesh Patel [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 02, 2005 9:41 AM
To: Log4J Users List
Subject: RE: Help getting started with Chainsaw V2

Hi Scott,

Well I ran my app locally and configured the log4j.xml file like this:

        <appender name="socketLogger"
class="org.apache.log4j.net.SocketAppender">
       <param name="RemoteHost" value="localhost"/>
       <param name="Port" value="4445"/>
       <param name="LocationInfo" value="false"/>
   </appender>

Then in Chainsaw set up a new SocketReceiver and gave a port of 4445.

It worked!!!!

Now I have deployed my app to a remote server with the settings above
but do not know how to configure the SocketReceiver in Chainsaw to
accept events. I tried to put the ip address of the remote server in the
listener property but it won't hold.

What am I missing?

Cheers

Rakesh

-----Original Message-----
From: Rakesh Patel
Sent: 02 November 2005 16:37
To: Log4J Users List
Subject: RE: Help getting started with Chainsaw V2


Thank you Scott. I will read through your post carefully.

Can I ask one quick question just in case - can I setup a SocketAppender
in my remote app sending events on port 4445 which is using log4j1.2x
and have them received by Chainsaw v2? If so, I can go through your mail
knowing its possible.

Cheers

Rakesh

-----Original Message-----
From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: 02 November 2005 16:16
To: Log4J Users List
Subject: RE: Help getting started with Chainsaw V2


Resending, hoping spaces make the table display correctly.

-----
Receivers do the work of getting logging events into the log4j framework
from some external source. Log4j 1.3 provides receivers that can process events generated by a
number of logging frameworks, custom SQL databases, and any
VFS-accessible file system.

Here's a list of event sources and receivers that can process the
events:

Network:
SocketAppender                                  SocketReceiver
UDPAppender                                     UDPReceiver
MulticastAppender                               MulticastReceiver
Log4CXX/Log4PHP/Log4Perl Socket Appender        XMLSocketReciever
Log4Net UDPAppender (using Log4j's DTD schema)  UDPReceiver
java.util.logging SocketHandler                 XMLSocketReceiver using
UtilLoggingXMLDecoder

Database:
DBAppender (log4j-defined schema)               DBReceiver
Custom schema (you specify the SQL)             CustomSQLDBReceiver

File:
FileAppender using PatternLayout                 LogFilePatternReceiver
(must be accessible as a URL)
VFS-supported file systems (SSH, FTP, etc) VFSLogFilePatternReceiver

You can also open existing logging files stored using log4j's XMLLayout
or java.util.logging's XMLFormatter from the File menu.

To automatically configure receivers in Chainsaw, create a log4j.xml
configuration file containing 'plugin' entries, similar to 'appender'
entries, but they define receiver configurations.

You can find an example receiver config file on Chainsaw's Welcome tab's
toolbar: the 'View example receiver configuration' button.
Create your own configuration file.  Select 'view, show application-wide
preferences' menu, specify the URL to your config file in the automatic
configuration URL box and restart Chainsaw.
You can also define many receivers from inside the Chainsaw GUI - select
the 'view, show receivers' menu item.  From there you can create new
receivers, delete receivers, change existing receiver configurations,
start and stop receivers, etc.

Scott

-----Original Message-----
From: Rakesh Patel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 02, 2005 7:38 AM
To: Log4J Users List
Subject: Help getting started with Chainsaw V2

Hi,

Must have missed something!

I have my log4j (actually nlog4j) set up quite nicely. I deployed
recently to our production boxes and thought it would be good to keep an
eye on it remotely. I had a little success with an Eclipse plugin called
Ganymede and a corresponding SocketAppender.

Anyway, Chainsaw looks much better so I installed it (via WebStart) and
started the tutorial. I know understand the GUI. However, where's the
information on how to setup log4j? I do not think I can remotely access
files on the boxes so I thought functionality like the SocketAppender
would be good.

Can anyone tell me or point me to the information on how to configure
log4j to send Chainsaw events?

Thanks

Rakesh


American Express Investments and American Express Independent Financial
Advisers are marketing names for American Express Financial Services
Europe Limited, a separate corporation within the American Express group
of companies.  American Express Financial Services Europe Limited is
authorised and regulated by, and is entered into the register (No.
190853 www.fsa.gov.uk/register/) of, the Financial Services Authority
and a member of the London Stock Exchange. Registered in England No.
3614902. Registered address: 230 Blackfriars Road, London SE1 8NW. Vat
No. 740 4143 68.
The information in this email and any attachments is confidential and
intended solely for the attention and use of the named addressee(s). It
may be subject to legal, professional or other privilege and further
distribution of it is strictly prohibited without our authority.  If you
are not the intended recipient, you are not authorised to and must not
disclose, copy, distribute, or retain this message or any part of it,
and should notify us immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



American Express Investments and American Express Independent Financial
Advisers are marketing names for American Express Financial Services
Europe Limited, a separate corporation within the American Express group
of companies.  American Express Financial Services Europe Limited is
authorised and regulated by, and is entered into the register (No.
190853 www.fsa.gov.uk/register/) of, the Financial Services Authority
and a member of the London Stock Exchange. Registered in England No.
3614902. Registered address: 230 Blackfriars Road, London SE1 8NW. Vat
No. 740 4143 68.
The information in this email and any attachments is confidential and
intended solely for the attention and use of the named addressee(s). It
may be subject to legal, professional or other privilege and further
distribution of it is strictly prohibited without our authority.  If you
are not the intended recipient, you are not authorised to and must not
disclose, copy, distribute, or retain this message or any part of it,
and should notify us immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



American Express Investments and American Express Independent Financial
Advisers are marketing names for American Express Financial Services
Europe Limited, a separate corporation within the American Express group
of companies.  American Express Financial Services Europe Limited is
authorised and regulated by, and is entered into the register (No.
190853 www.fsa.gov.uk/register/) of, the Financial Services Authority
and a member of the London Stock Exchange. Registered in England No.
3614902. Registered address: 230 Blackfriars Road, London SE1 8NW. Vat
No. 740 4143 68.
The information in this email and any attachments is confidential and
intended solely for the attention and use of the named addressee(s). It
may be subject to legal, professional or other privilege and further
distribution of it is strictly prohibited without our authority.  If you
are not the intended recipient, you are not authorised to and must not
disclose, copy, distribute, or retain this message or any part of it,
and should notify us immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to