3

I recently figured out how to output log4cplus messages in a format compatible with LogFactor5 in my C++ application:

In my log4cplus.properties file I have the following appender defined:

# LogFactor5 appender
log4cplus.appender.LogFactor5=log4cplus::RollingFileAppender
log4cplus.appender.LogFactor5.Schedule=DAILY
log4cplus.appender.LogFactor5.File=/home/ken/logs/project1.logfactor5
log4cplus.appender.LogFactor5.Append=true
log4cplus.appender.LogFactor5.MaxBackupIndex=9
log4cplus.appender.LogFactor5.MaxFileSize=100KB
log4cplus.appender.LogFactor5.layout=log4cplus::PatternLayout
log4cplus.appender.LogFactor5.layout.ConversionPattern=[slf5s.start]%d{%d %b %Y %H:%M:%S,%Q}[slf5s.DATE]%n%p[slf5s.PRIORITY]%n%x[slf5s.NDC]%n%t[slf5s.THREAD]%n%c[slf5s.CATEGORY]%n%l[slf5s.LOCATION]%n%m[slf5s.MESSAGE]%n%n

However, I would like to do something similar for Chainsaw but have not found the correct format. What is the log message format required by Chainsaw?

Does Chainsaw expect the log messages to be an XML format? Does log4cplus provide XML appenders?

Thanks.

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
kmccoy
  • 2,761
  • 3
  • 25
  • 29

2 Answers2

2

Log4cplus has grown Log4jUdpAppender in version 1.1.0. Test it.

At this point Log4cplus does not provide any XML appenders. I am certainly open to suggestions how such appender should behave. Please point me at some specification of Chainsaw compatible XML log file.

EDIT1:

log4cplus.properties example:

log4cplus.appender.TEST=log4cplus::Log4jUdpAppender
log4cplus.appender.TEST.host=localhost
log4cplus.appender.TEST.port=4445
wilx
  • 17,697
  • 6
  • 59
  • 114
  • Thanks. Can you point me in the direction of a log4cplus.properties example? – kmccoy Nov 17 '12 at 03:34
  • I launched Chainsaw v2 with the "Simple Receiver" on port 4560 (and changed the port number in the configuration file) but am getting the error: "log4cplus:ERROR Log4jUdpAppender::append()- Cannot write to server". Do you have any suggestions on how to resolve this? Thanks – kmccoy Dec 27 '12 at 12:27
2

Chainsaw V2 can parse and tail regular text files generated by any logging framework, so you aren't required to generate XML-formatted logs.

I'd suggest trying the developer snapshot, at http://people.apache.org/~sdeboy (run the chainsaw/chainsaw.bat file in the zip, or the Mac app from the DMG), and walk through the configuration dialog to define the log format of your log file.

Feel free to send an email to sdeboy at my apache.org address or post a question on the log4j user list if you have further questions.

Scott
  • 1,728
  • 11
  • 11
  • When I try to log into a SocketAppender ChainSaw reports an error: Connection lost! :: invalid stream header: 000000B3. Does anybody knows what can cause this? – MaksymB Sep 10 '13 at 17:23