[logback-dev] [JIRA] Issue Comment Edited: (LBCORE-128) Please support implementation of binary log files in RollingFileAppender/FileAppender

Joern Huxhorn (JIRA) noreply-jira at qos.ch
Fri Feb 19 12:24:33 CET 2010


    [ http://jira.qos.ch/browse/LBCORE-128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11542#action_11542 ] 

Joern Huxhorn edited comment on LBCORE-128 at 2/19/10 12:23 PM:
----------------------------------------------------------------

Yes, you understood it correctly. The wrapping is recreated for every event, incl. finish() and flush().

I'm fine with the doEncode method, but why is Encoder extending ContextAware and LifeCycle? And what is the reason for close?
Is Encoder supposed to be stateful?

I guess so, but it might be better in that case to define it like this:
public interface Encoder<E> extends ContextAware, LifeCycle {
  setOutputStream(OutputStream os);
  void doEncode(E event) throws IOException; // does nothing if os is null
  void close() throws IOException;  // does nothing if os is null
}

Concerning your edit in the comment above:
I thought Encoder would also be used in other Appenders, i.e. SocketAppender. If this would be the case, the new SocketAppender wouldn't be able to stay compatible with the current one since it streams a fixed amount before recreating the ObjectOutputStream (if I remember correctly).

I'll try to take a look at your branch this weekend.
Unfortunately, I won't be able to check it out today.

      was (Author: jhuxhorn):
    I'm fine with the doEncode method, but why is Encoder extending ContextAware and LifeCycle? And what is the reason for close?
Is Encoder supposed to be stateful?

I guess so, but it might be better in that case to define it like this:
public interface Encoder<E> extends ContextAware, LifeCycle {
  setOutputStream(OutputStream os);
  void doEncode(E event) throws IOException; // does nothing if os is null
  void close() throws IOException;  // does nothing if os is null
}

I think I'll just wait for your results and have a look when it's ready.
  
> Please support implementation of binary log files in RollingFileAppender/FileAppender
> -------------------------------------------------------------------------------------
>
>                 Key: LBCORE-128
>                 URL: http://jira.qos.ch/browse/LBCORE-128
>             Project: logback-core
>          Issue Type: Improvement
>          Components: Appender
>    Affects Versions: 0.9.17
>            Reporter: Joern Huxhorn
>            Assignee: Ceki Gulcu
>
> This was discussed briefly at http://marc.info/?l=logback-dev&m=124905434331308&w=2 and I forgot to file a ticket about this.
> Currently, RandomFileAppender => FileAppender => WriterAppender is using the following method in WriterAppender to actually write the data:
> protected void writerWrite(String s, boolean flush) throws IOException
> Please add an additional method like
> protected void writerWrite(byte[] bytes, boolean flush) throws IOException
> to write to the underlying stream directly.
> writerWrite(String, boolean) could call that method after performing the transformation internally, making this change transparent for the rest of the implementation.
> Using a binary format for logfiles could have tremendous performance impact as can be seen here: http://sourceforge.net/apps/trac/lilith/wiki/SerializationPerformance

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list