Re: [Log4j] Binary layout

2018-01-16 Thread Mikael Ståldal
I am experimenting with an Avro layout: https://github.com/apache/logging-log4j-plugins/tree/avro-layout It happens to be the case that the generated Avro value class implements Serializable, but is it appropriate to return that? Or should it return null? What if you want to make another

Re: [Log4j] Binary layout

2018-01-16 Thread Ralph Goers
Well, in looking at the various uses of that method I am a bit confused. 1. The JMSAppender will use Java serialization if it isn’t a MapMessage or a String. 2. CassandraManager uses some sort of TypeConverter to convert the Serializable - but it only seems to handle a limited set of types.

Re: [Log4j] Binary layout

2018-01-16 Thread Remko Popma
I think what Mikael meant is that Serializable is just a marker interface that does not provide any guidance on what methods to call on it to turn the result into bytes. Unless we want to use java serialization, and I presume one of the main reasons for creating a custom binary layout (other than

Re: [Log4j] Binary layout

2018-01-16 Thread Ralph Goers
I think MessageLayout is a special case as it only returns the message portion of the LogEvent. Most Layouts return all of the LogEvent attributes. Even so, you could have AbstractLayout if you wanted the serialized version of the LogEvent. It can also be anything else that implements

Re: [Log4j] Binary layout

2018-01-16 Thread Remko Popma
Doesn't that depend on the generic type T of the Layout? For example, MessageLayout extends AbstractLayout returns a Message instance. You could return a ByteBuffer, but generally for an efficient binary layout I would look at the encode method instead. On Tue, Jan 16, 2018 at 11:45 PM, Mikael

Re: [Log4j] Binary layout

2018-01-16 Thread Ralph Goers
> On Jan 16, 2018, at 7:45 AM, Mikael Ståldal wrote: > > How is a binary layout (extending AbstractLayout) supposed to implement the > toSerializable method in the Layout interface? > > Why is that method there? > > You would implement it the same way all the other

[Log4j] Binary layout

2018-01-16 Thread Mikael Ståldal
How is a binary layout (extending AbstractLayout) supposed to implement the toSerializable method in the Layout interface? Why is that method there?