[prev in list] [next in list] [prev in thread] [next in thread]
List: logback-dev
Subject: Re: [logback-dev] Question about a custom binary file appender.
From: Maarten Bosteels <mbosteels.dns () gmail ! com>
Date: 2009-04-24 8:58:04
Message-ID: 5e87acee0904240158n40590d1q582b0839fb93011f () mail ! gmail ! com
[Download RAW message or body]
What about intrducing the Encoder interface I proposed some weeks ago ?
http://code.google.com/p/firewood/source/browse/trunk/compare-formats/src/main/java/com/googlecode/firewood/encoder
==============================
import java.io.OutputStream;
import java.io.IOException;
import ch.qos.logback.classic.spi.ILoggingEvent;
public interface Encoder <T extends OutputStream>{
void encode(ILoggingEvent event, T output) throws IOException;
T decorate(OutputStream os) throws IOException;
}
==============================
import ch.qos.logback.classic.spi.ILoggingEvent;
import java.io.OutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
/**
* Encoder that uses plain Java Serialization
*/
public class ObjectEncoder implements Encoder<ObjectOutputStream> {
public void encode(ILoggingEvent event, ObjectOutputStream output)
throws IOException {
output.writeObject(event);
}
public ObjectOutputStream decorate(OutputStream os) throws IOException {
return new ObjectOutputStream(os);
}
}
=====================================
By the way, Joern, trying out a recent version of Lilith is still on
my todo list.
regards,
Maarten
On Thu, Apr 23, 2009 at 6:38 PM, Joern Huxhorn <jhuxhorn@googlemail.com> wrote:
> Hi Ceki.
>
> I'd like to implement a file appender that writes the binary Lilith
> format, i.e. gzipped protobuf-serialized events, instead of Strings.
> I'd also like to have the same functionality that's supported by
> RollingFileAppender right now.
>
> Unfortunately, there seems to be no way to simply write bytes instead of
> a String. How would you go from here?
> Reimplementing everything from the start seems to be a pretty bad idea.
>
> What do you think about enhancing the RFA so it's using byte[] instead
> of Strings? The current behavior could be implemented using those
> methods + string.getBytes("UTF-8") or CharsetEncoder...
>
> Any idea, suggestions?
>
> Regards,
> Joern.
>
> _______________________________________________
> logback-dev mailing list
> logback-dev@qos.ch
> http://qos.ch/mailman/listinfo/logback-dev
>
_______________________________________________
logback-dev mailing list
logback-dev@qos.ch
http://qos.ch/mailman/listinfo/logback-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic