You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/07/24 18:52:24 UTC
[GitHub] [pulsar] one70six opened a new issue #4796: Enhance Log Topics for
Pulsar Functions
one70six opened a new issue #4796: Enhance Log Topics for Pulsar Functions
URL: https://github.com/apache/pulsar/issues/4796
**Is your feature request related to a problem? Please describe.**
When using the `logTopic` feature of Pulsar Functions it works great, but seems a bit limited in it's usage as only the message body is being sent to the logTopic as `byte[]`.
**Describe the solution you'd like**
Add an additional` LogAppender.append` method override that allows for the `org.apache.logging.log4j.core.LogEvent` object to be sent to the logTopic directly or allow the logTopic to except a custom schema and not just `byte[]`. This would allow consumers of the log topic to decipher what messages are of type INFO, WARN, ERROR, etc. The metadata in the `org.apache.logging.log4j.core.LogEvent` objects could be very valuable on the log consumption and analytics side.
### src/main/java/org/apache/pulsar/functions/instance/LogAppender.java
#### Original
```java
@Override
public void append(LogEvent logEvent) {
producer.sendAsync(logEvent.getMessage().getFormattedMessage().getBytes());
}
```
### Potential future maybe?
```java
@Override
public void append(LogEvent logEvent) {
producer.sendAsync(logEvent);
}
```
**Describe alternatives you've considered**
I have considered creating a custom schema and topic and then just having my functions publish to that via the following and not using the built in Logger at all:
`context.newOutputMessage((Log) topicToWrite.get(), Schema.LOG).value(input).sendAsync();`
I would rather use the functions built in Logger if at all possible.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services