[logback-dev] Layout setter/getter methods in AppenderBase
Joern Huxhorn
jhuxhorn at googlemail.com
Fri Feb 13 20:09:53 CET 2009
I'm in favor of the two interfaces suggested but I wanted to point out
that the current implementation of SocketAppender could not be changed
in a compatible way to implement EncoderAware because it is currently
using a stream of serialized objects instead of byte[] for each object
(using a new ObjectOutputStream for each new object). This would have
to be changed.
On 13.02.2009, at 17:06, Ceki Gulcu wrote:
> Maarten Bosteels wrote:
>> interface LayoutAware extends Appender;
>> interface EncoderAware extends Appender;
>> I don't understand.
>> In my opinion LayoutAware and EncoderAware should be standalone
>> interface with just a getter and a setter, and not extend Appender.
>
> Yes, obviously.
>
>> All appenders that need a layout should implement LayoutAware.
>> They can implement the interface themselves or - when its practical
>> - inherit from LayoutAwareAppenderBase
>
> Agreed.
>
>> Why would you tie LayoutAware to the Appender interface.
>
> You could tie the two interfaces by mistake. :-)
>
>> PS: Not yet sure whether the encode method should return a byte[]
>> or a java.nio.ByteBuffer, I think the latter is easier to use.
>
> That would would be an option to consider.
I would suggest to use byte[] because it can easily be transformed
into a ByteBuffer using ByteBuffer.wrap() while the other direction
using byte[] ByteBuffer.buffer() is marked as an optional operation.
Regards,
Joern.
More information about the logback-dev
mailing list