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">

    <file>log_output_serialized.bin</file>

    <append>false</append>

    <encoder class="ch.qos.logback.core.encoder.ObjectStreamEncoder" />

  </appender>

 

  <root level="ALL">

    <appender-ref ref="STDOUT" />

    <appender-ref ref="SERIALIZED_FILE" />

  </root>

 

 

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

 

 

 

Rich Wagner | Senior Software Engineer | StreamBase Systems, Inc., 181 Spring Street, Lexington, MA 02421

rwagner@streambase.com | (p) +1 781-761-0868 | http://www.streambase.com


StreamBase - 2010 World Economic Forum Technology Pioneer