[
https://issues.apache.org/jira/browse/SAMZA-479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14273740#comment-14273740
]
Chris Riccomini commented on SAMZA-479:
---------------------------------------
What about a variation of (2), where we construct a new
[LoggingEvent|https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/spi/LoggingEvent.html]?
Something like this:
{code}
private LoggingEvent subLog(LoggingEvent le) {
return new LoggingEvent(
le.getFQNOfLoggerClass(),
le.getLogger(),
le.getTimeStamp(),
le.getLevel(),
subAppend(le),
le.getThreadName(),
le.getThrowableInformation(),
le.getNDC(),
le.getLocationInformation(),
le.getProperties());
}
{code}
Then we can call:
{code}
new OutgoingMessageEnvelope(systemStream, key.getBytes("UTF-8"),
subLog(event));
{code}
This approach would allow us to use any Serde<LoggingEvent>. I think that this
approach is cleaner, overall. Although it's not as friendly for JsonSerde, it's
friendlier for non JSON serdes (e.g. Avro, Protobuf, etc). In JSON's case, we'd
just write a LoggingEventJsonSerde that extends JSON serde, and converts
LoggingEvent to a Map before calling JsonSerde.toBytes.
> Make StreamAppender pluggable for different log formats
> -------------------------------------------------------
>
> Key: SAMZA-479
> URL: https://issues.apache.org/jira/browse/SAMZA-479
> Project: Samza
> Issue Type: Improvement
> Affects Versions: 0.9.0
> Reporter: Yan Fang
> Assignee: Yan Fang
> Fix For: 0.9.0
>
>
> Currently the StreamAppender only accepts String and sends String as the
> format for all the logs. It will be useful to have StreamAppender to accept
> and send other formats, such as Avro, JSON, etc. So the idea is to move the
> encoding of the LoggingEvent to a serde.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)