<br><div class="gmail_quote">On Sat, Aug 1, 2009 at 8:33 PM, Ceki Gulcu <span dir="ltr"><<a href="mailto:ceki@qos.ch">ceki@qos.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Thank you for reminding us about the prototype. I find it very<br>
informative and helpful.<br>
<br>
As I see things, the Encoder interface and the various implementations<br>
you have written show that it is not sufficient to return a byte array<br>
for a given ILoggingEvent, the "encoder" also needs to know how to<br>
write to the underlying OutputStream, it may also need to decorate the<br>
underlying OutputStream with its own (e.g. ObjectOutputStream for<br>
serialization).<br>
<br>
Consequently, I'd propose to rename the Encoder interface as<br>
ILoggingEventWriter. (In my mind at least, an Encoder is associated with<br>
transforming data into bytes.)<br>
<br>
So here is my revised interface:<br>
<br>
public interface Encoder <T extends OutputStream> {<br>
 void write(ILoggingEvent event, T output) throws IOException;<br>
 T decorate(OutputStream os) throws IOException;<br>
}</blockquote><div><br>I guess you forgot to rename the interface itself ;-)<br><br>From <a href="http://en.wikipedia.org/wiki/Encoder">http://en.wikipedia.org/wiki/Encoder</a>Â "An encoder is a device, circuit, transducer, software program, algorithm or person that converts information from one format, or code to another..."<br>
So I think calling it Encoder is appropriate, but I have no string feeling about the name of the interface. <br>Â <br>The terminology also used in MINA: <a href="http://mina.apache.org/report/trunk/apidocs/org/apache/mina/filter/codec/ProtocolEncoder.html">http://mina.apache.org/report/trunk/apidocs/org/apache/mina/filter/codec/ProtocolEncoder.html</a><br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
What should be done about methods such as getFileHeader(),<br>
getFileFooter(), getPresentationHeader() and getPresentationFooter()<br>
from the Layout interface? Â My first reaction would be to rename getX()<br>
as writeX(OutputStream).</blockquote><div><br>Sounds OK to me. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
This is all I have time for at this moment but I would really like to<br>
pursue this exchange.</blockquote><div><br>That's cool !<br><br>I have no idea how much work it is to support encoders in the logback.xml file. <br>I mean, we should be able to tell logback to use a XXXAppender with a ZZZEncoder ?<br>
<br>Regards<br>Maarten <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
Cheers,<br>
<br>
Maarten Bosteels wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
Hi Ceki and Joern,<br>
<br>
Remember the Encoder interface we discussed in the past ?<br>
To make the aspect of encoding a LoggingEvent pluggable, and thus the Appender implementation more reusable.<br>
<br>
I have small prototype here : <br>
<a href="http://tinyurl.com/encoder-interface" target="_blank">http://tinyurl.com/encoder-interface</a><br>
<a href="http://tinyurl.com/encoder-example" target="_blank">http://tinyurl.com/encoder-example</a><br>
<br>
regards,<br>
Maarten<br>
<br></div><div class="im">
On Fri, Jul 31, 2009 at 5:51 PM, Ceki Gulcu <<a href="mailto:ceki@qos.ch" target="_blank">ceki@qos.ch</a> <mailto:<a href="mailto:ceki@qos.ch" target="_blank">ceki@qos.ch</a>>> wrote:<br>
<br>
<br>
  Hi Joern,<br>
<br>
  Plese enter a bug report with as much information as you can about the<br>
  code you'd like to see changed.  In principle, very little code is<br>
  involved in actually writing to the file so the task would seem rather<br>
  easy. However, WriterAppender on which FileAppender and<br>
  RollingFileAppender are built upon uses a Writer to write whatever it<br>
  is that needs to be written. Unfortunately, a Writer knows how to<br>
  writes String or chars, but not bytes.<br>
<br>
  Nevertheless, I think it's feasible with some work...<br>
<br>
  Joern Huxhorn wrote:<br>
<br>
    Hi Ceki.<br>
<br>
    I've seen that you are working on the FileAppenders again. Have<br>
    you seen this mail I wrote? What do you think about it?<br>
<br>
    Joern.<br>
<br>
    Begin forwarded message:<br>
<br>
      *From: *Joern Huxhorn <<a href="mailto:jhuxhorn@googlemail.com" target="_blank">jhuxhorn@googlemail.com</a><br>
      <mailto:<a href="mailto:jhuxhorn@googlemail.com" target="_blank">jhuxhorn@googlemail.com</a>><br></div>
      <mailto:<a href="mailto:jhuxhorn@googlemail.com" target="_blank">jhuxhorn@googlemail.com</a><div class="im"><br>
      <mailto:<a href="mailto:jhuxhorn@googlemail.com" target="_blank">jhuxhorn@googlemail.com</a>>>><br>
<br>
      *Date: *23. April 2009 18:38:38 MESZ<br>
      *To: *logback developers list <<a href="mailto:logback-dev@qos.ch" target="_blank">logback-dev@qos.ch</a><br></div>
      <mailto:<a href="mailto:logback-dev@qos.ch" target="_blank">logback-dev@qos.ch</a>> <mailto:<a href="mailto:logback-dev@qos.ch" target="_blank">logback-dev@qos.ch</a><div class="im"><br>
      <mailto:<a href="mailto:logback-dev@qos.ch" target="_blank">logback-dev@qos.ch</a>>>><br>
<br>
      *Subject: **Question about a custom binary file appender.*<br>
<br>
      Hi Ceki.<br>
<br>
      I'd like to implement a file appender that writes the binary<br>
      Lilith<br>
      format, i.e. gzipped protobuf-serialized events, instead of<br>
      Strings.<br>
      I'd also like to have the same functionality that's supported by<br>
      RollingFileAppender right now.<br>
<br>
      Unfortunately, there seems to be no way to simply write<br>
      bytes instead of<br>
      a String. How would you go from here?<br>
      Reimplementing everything from the start seems to be a<br>
      pretty bad idea.<br>
<br>
      What do you think about enhancing the RFA so it's using<br>
      byte[] instead<br>
      of Strings? The current behavior could be implemented using<br>
      those<br>
      methods + string.getBytes("UTF-8") or CharsetEncoder...<br>
<br>
      Any idea, suggestions?<br>
<br>
      Regards,<br>
      Joern.<br>
<br>
<br>
<br>
    ------------------------------------------------------------------------<br>
<br>
    _______________________________________________<br>
    logback-dev mailing list<br>
    <a href="mailto:logback-dev@qos.ch" target="_blank">logback-dev@qos.ch</a> <mailto:<a href="mailto:logback-dev@qos.ch" target="_blank">logback-dev@qos.ch</a>><br></div><div class="im">
    <a href="http://qos.ch/mailman/listinfo/logback-dev" target="_blank">http://qos.ch/mailman/listinfo/logback-dev</a><br>
<br>
<br>
  --   Ceki Gülcü<br>
  Logback: The reliable, generic, fast and flexible logging framework<br>
  for Java.<br>
  <a href="http://logback.qos.ch" target="_blank">http://logback.qos.ch</a><br>
  _______________________________________________<br>
  logback-dev mailing list<br></div><div class="im">
  <a href="mailto:logback-dev@qos.ch" target="_blank">logback-dev@qos.ch</a> <mailto:<a href="mailto:logback-dev@qos.ch" target="_blank">logback-dev@qos.ch</a>><br></div><div class="im">
  <a href="http://qos.ch/mailman/listinfo/logback-dev" target="_blank">http://qos.ch/mailman/listinfo/logback-dev</a><br>
<br>
<br>
<br>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
logback-dev mailing list<br>
<a href="mailto:logback-dev@qos.ch" target="_blank">logback-dev@qos.ch</a><br>
<a href="http://qos.ch/mailman/listinfo/logback-dev" target="_blank">http://qos.ch/mailman/listinfo/logback-dev</a><br>
</div></blockquote><div><div></div><div class="h5">
<br>
-- <br>
Ceki Gülcü<br>
Logback: The reliable, generic, fast and flexible logging framework for Java.<br>
<a href="http://logback.qos.ch" target="_blank">http://logback.qos.ch</a><br>
_______________________________________________<br>
logback-dev mailing list<br>
<a href="mailto:logback-dev@qos.ch" target="_blank">logback-dev@qos.ch</a><br>
<a href="http://qos.ch/mailman/listinfo/logback-dev" target="_blank">http://qos.ch/mailman/listinfo/logback-dev</a><br>
</div></div></blockquote></div><br>