GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [improve] PIP-467: Convert pulsar-functions module logging from SLF4J to slog by merlimat · Pull Request #25508 · apache/pulsar

Conversation

@merlimat

@merlimat merlimat commented Apr 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

  • Convert 106 source and test files across all pulsar-functions submodules from SLF4J to slog structured logging
  • Submodules: worker, instance, runtime, utils, java-examples, localrun, api-java
  • Files using context.getLogger() (public API returning org.slf4j.Logger) left unchanged

Test plan

  • compileJava and compileTestJava pass for all submodules
  • checkstyleMain and checkstyleTest pass for all submodules
  • CI passes

Motivation

PIP-467

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
merlimat added 5 commits April 10, 2026 12:42
@merlimat
[improve] PIP-467: Convert pulsar-functions module logging from SLF4J…
feda0f1
… to slog
@merlimat
Allow slog classes in JavaInstanceDepsTest allowlist
5df2a0e
The slog library classes are now part of the runtime-all shaded jar
since pulsar-functions-api exports slog as an API dependency.
@merlimat
Use log.infof() in TestPayloadProcessor for test compatibility
7d92d56
The integration test checks that "TestPayloadProcessor constructor
with configs key=value" appears as a substring in the function logs.
Using infof() ensures the configs string is inlined in the message.
@merlimat
Fix integration test to not depend on log message format
2d235d1
The checkLogs test was checking for the full formatted log message
as a substring. With slog, the config values are structured attrs
rather than inlined in the message. Fix the test to check for the
message and each config key=value pair independently.
@merlimat
Remove unused Collectors import from PulsarFunctionsTest
0f4063c
dao-jun
dao-jun approved these changes Apr 13, 2026
View reviewed changes
lhotari
lhotari approved these changes Apr 13, 2026
View reviewed changes
merlimat added 4 commits April 13, 2026 09:42
@merlimat
Fix checkLogs test to not depend on BatchingConfig.toString() format
0be2718
The test was checking for the exact Lombok toString() output of
BatchingConfig in the function logs. With slog, the config is
logged as a structured attr, so the exact format differs. Check
for the key fields instead.
@merlimat
Move enabled=X log assertion under PROCESS runtime check
b7b4939
The THREAD runtime doesn't produce the function config log line in
the function logs file, so this assertion only makes sense for
PROCESS runtime (which is already where the more detailed checks
were happening).
@merlimat
Remove BatchingConfig toString assertion from checkLogs
8df793e
The assertion was relying on the Lombok @DaTa toString format
produced by SLF4J parameter substitution. With slog, the attr value
is rendered differently and THREAD runtime doesn't produce this log
line at all. The PROCESS-runtime JSON check ("batchingEnabled":false)
already covers this.
@merlimat
Revert TestPayloadProcessor to @slf4j to preserve function log routing
f4819c7
In THREAD runtime, function logs are routed to per-function log files
via log4j2 RoutingAppender using `$${ctx:function}` etc, which reads
from the LogEvent's contextData. JavaInstanceRunnable populates these
keys via `ThreadContext.put(...)`, and SLF4J/log4j2 normally injects
the ThreadContext into each event's contextData automatically.

slog's Log4j2Logger builds its own MutableLogEvent and calls
`event.setContextData(buildContextData(...))`, which only includes
slog attrs (or null when there are none). This bypasses log4j2's
ContextDataInjector, so `ctx:function` is not found at routing time
and the log message never reaches the function-specific log file.

The integration test `testJavaExclamationMessagePayloadProcessor`
asserts that TestPayloadProcessor's constructor log appears in the
function logs even in THREAD runtime, which worked before because
`@Slf4j` went through the normal log4j2 path. Keeping the example as
@slf4j restores this behavior without touching slog or the test.
@merlimat
merlimat merged commit 840fc34 into apache:master Apr 15, 2026
80 of 82 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@merlimat
merlimat deleted the slog-functions branch April 15, 2026 05:33
@ashwindakappagari ashwindakappagari mentioned this pull request Jun 4, 2026
[Bug] [functions-worker] WorkerUtils.createExclusiveProducerWithRetry leaks orphan exclusive producer when createAsync().get() times out #25936
Closed
3 tasks done
@lhotari lhotari added this to the 5.0.0-M1 milestone Jun 12, 2026
dao-jun added a commit to ascentstream/pulsar that referenced this pull request Sep 21, 2026
@dao-jun
[fix][fn] Bundle slog into java-instance.jar so process-runtime insta…
818079b
…nces start with BookKeeper 4.18

BookKeeper 4.18's allocator classes log through slog, whose Log4j2 backend
probes for disruptor with its own classloader and, when disruptor is visible,
evaluates log4j's AsyncLogger (implements EventTranslatorVararg on log4j
2.26.x). In the function instance JVM the root classloader holds only
java-instance.jar (log4j bundled, disruptor not) while the child classloader
(/pulsar/lib) has disruptor via bookkeeper-server, so the probe enabled the
async fast path and the parent-delegated AsyncLogger definition failed with
NoClassDefFoundError: com/lmax/disruptor/EventTranslatorVararg. Every
process-runtime function/source instance died at startup, failing the System
jobs: PulsarMetadataStateStoreTest.testJavaWordCountFunction,
PulsarFunctionsJavaProcessTest.testAutoSchemaFunctionTest,
PulsarDebeziumSourcesTest.testDebeziumMongoDbSource and
PulsarDebeziumOracleSourceTest.testDebeziumOracleDbSource.

Bundling slog (zero transitive dependencies) into java-instance.jar - the
same jar content upstream master reaches via PIP-467 (apache#25508, slog on
pulsar-functions-api) - makes the probe run in the root classloader where
disruptor is absent, keeping the fast path disabled. JavaInstanceDepsTest
whitelists io/github/merlimat/slog, matching upstream.

Verified A/B locally against the built distribution: with the previous jar
the instance dies with the exact CI signature; with the bundled-slog jar the
wordcount instance reaches running=true and processes messages
(numReceived/numSuccessfullyProcessed > 0).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@lhotari lhotari lhotari approved these changes
@dao-jun dao-jun dao-jun approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

5.0.0-M1

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@merlimat @lhotari @dao-jun
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.