freeznet opened a new pull request #9299: URL: https://github.com/apache/pulsar/pull/9299
Fixes #7814 ### Motivation `JavaInstanceRunnable` create an instance of logger named `"function-" + instanceConfig.getFunctionDetails().getName()` and pass it to `Function Context`, and the logger can be used to send user defined content to function's log-topic if `--log-topic` defined. as issue #7814 mentioned, the logger is not working as expected since user cannot consume any self defined log content from `log-topic`. this happens in process runtime with created functions, but not noticed with other situation such as `localrun` function. Through debug to the created function, the logger from `Function Context` is different the logger from `JavaInstanceRunnable`, such as the `contextName` as images shown below. In addition, the `LogAppender` set in `JavaInstanceRunnable` is not shown in `Function Context`'s logger as well.  ^^^^ from JavaInstanceRunnable  ^^^^ from Function Context After some tests, I find out that when get `LoggerContext` by `LoggerContext.getContext()`, the context's logAppender can be take effect to `Function Context`, and the `Function Context`'s logger works great. ### Modifications Add `LogAppender` to the single context from `LoggerContext.getContext()`. ### Verifying this change - [ ] Make sure that the change passes the CI checks. ---------------------------------------------------------------- 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: [email protected]
