Inter-operable log4php and Chainsaw/remote log viewer

274 Views Asked by At

I'm in need of a remote log viewer like chainsaw for log4php. When i use log4j, chainsaw is my first option, where as though log4php is same to log4j, chainsaw is not responding well.

For, eg., i gave this config

log4php.appender.A3=LoggerAppenderSocket 
log4php.appender.A3.remoteHost=cin10050
log4php.appender.A3.port=4445
log4php.appender.A3.layout=LoggerLayoutXml

Chainsaw generates a log message in chainsaw-logs :

Connection lost! :: invalid stream header: 3C6C6F67

Does any one have a solution?

Thanks

1

There are 1 best solutions below

2
On

Chainsaw provides an XMLSocketReceiver, which could be used to receive events from log4php, but I don't think they send events in a format that the receiver can process.

I'd suggest logging to a regular text log file and using the latest developer snapshot of Chainsaw, available here: http://people.apache.org/~sdeboy

Use the 'File,Load Chainsaw configuration' option and select 'process a log file'. Then hit the 'open file' to browse to your log file location, and then specify your 'log file format'. A simple one that will always work is: MESSAGE

That format will just make the entire log line the 'message' field. If you'd like Chainsaw to parse your levels and timestamps etc, that's possible, you just need to use the keywords and match up your format.

Then, click the 'always start Chainsaw with this configuration' check box, and then hit the 'save configuration as' button and save your chainsaw configuration to something like log4php-chainsaw-config.xml.

When you hit ok, you should get a new tab with your log file contents.

Scott