Closed
Description
Describe the bug
When using the context's logger, log messages are not produced on the function's log topic.
Relevant docs: https://pulsar.apache.org/docs/en/functions-debug/#use-log-topic
To Reproduce
Steps to reproduce the behavior:
- Create a Pulsar Function which logs a message using the context's logger (see
LoggingFunction.java
example below) - Deploy said function using
pulsar-admin
specifying a log-topic in the create command - Trigger the function / produce a message on one of its input topics
- Log messages appear in the function's log file only
Expected behavior
Expected to see the log message produced on the function's log topic in addition to being printed to the log file.
Screenshots
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LoggingFunction implements Function<String, Void> {
@Override
public void apply(String input, Context context) {
Logger LOG = context.getLogger();
Logger LOG2 = LoggerFactory.getLogger(this.getClass);
LOG.info("This message appears in log file only")
LOG2.info("This message appears in log file AND log topic")
}
}
$ bin/pulsar-admin functions create \
--log-topic persistent://public/default/logging-function-logs \
# Other function configs
Desktop (please complete the following information):
- OS: iOS
Additional context
Pulsar 2.6.0 running in standalone mode (not in a docker container)
Activity