[logback-user] Q: How to capture SocketAppender-format data to a file?
rwagner at streambase.com
Thu Apr 7 01:15:49 CEST 2011
Hi - Sorry in advance if this is a FAQ: I didn't find an answer after searching for a while, hence this email...
On the one hand, I'm using a SocketAppender for sending serialized LoggingEventVO objects from some of my company's software (which I help develop) to a custom consumer of such events. That works just fine.
But now I also want to configure a "logback.xml" file so that the same kind of serialized LoggingEventVO objects can alternatively be captured to a file. We need that when either QA engineers or end-users are running the software, but do not have access to the socket server that I use (and hence can't use the SocketAppender). The hope is that then the QA engineer or end-user could get that log file to me, and I could have my serialized event consumer read from the file, instead of getting the data from a socket connection. Then I can diagnose that QA person's problem, or end-user's problem.
However, I don't know what particular logback XML to use. I tried a "FileAppender" / "ObjectStreamEncoder" combination, but the file ended up being empty (whereas a simple ConsoleAppender proved there were in fact events to capture). Here's my failed XML:
<appender name="SERIALIZED_FILE" class="ch.qos.logback.core.FileAppender">
<encoder class="ch.qos.logback.core.encoder.ObjectStreamEncoder" />
<appender-ref ref="STDOUT" />
<appender-ref ref="SERIALIZED_FILE" />
Do I need to write my own variant of "FileAppender": one which (like SocketAppender) doesn't use an Encoder, but instead bakes in the code to serialize LoggingEventVO objects?
Thanks in advance,
Rich Wagner | Senior Software Engineer | StreamBase Systems, Inc., 181 Spring Street, Lexington, MA 02421
rwagner at streambase.com<mailto:rwagner at streambase.com> | (p) +1 781-761-0868 | http://www.streambase.com<http://www.streambase.com/>
StreamBase - 2010 World Economic Forum Technology Pioneer<http://www.time.com/time/specials/packages/article/0,28804,1948486_1948485_1948478,00.html>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Logback-user