Skip to content

fix: prevent rich markup leakage to non-rich handlers#5200

Closed
CommitToday wants to merge 2 commits intokedro-org:mainfrom
CommitToday:fix-issue-5199-rich-logging-integration-mishandles-kedro-node-bra
Closed

fix: prevent rich markup leakage to non-rich handlers#5200
CommitToday wants to merge 2 commits intokedro-org:mainfrom
CommitToday:fix-issue-5199-rich-logging-integration-mishandles-kedro-node-bra

Conversation

@CommitToday
Copy link

Overview

This PR addresses issue #5199 by preventing rich markup tags from leaking to file handlers when mixed logger handlers are present. The fix involves updating the logic that determines when to use rich markup in logging calls.

Checklist

  • Code changes implemented
  • Tests updated (pending)
  • Documentation updated

Proof

The fix ensures that rich markup is only enabled when all handlers attached to a logger are RichHandlers. This prevents markup leakage to non-rich handlers like file handlers. The changes include:

  • Adding a new utility function _has_only_rich_handlers to check if all handlers are RichHandlers
  • Updating DataCatalog to use this new function instead of _has_rich_handler
  • Adding markup=False to Node logging calls to prevent markup in log messages

Closes #5199

Signed-off-by: SoulSniper1212 <warush23@gmail.com>
return any(isinstance(handler, RichHandler) for handler in logger.handlers)


def _has_only_rich_handlers(logger: logging.Logger | None = None) -> bool:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this method is very similar to _has_rich_handlers, could we just use this new method everywhere instead?

Copy link
Member

@merelcht merelcht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this PR @SoulSniper1212 ! ⭐ I haven't tried this properly yet, but left a quick question and ran the CI checks to see if they all run fine.

@merelcht
Copy link
Member

Hi @CommitToday are you still interested in working on this?

@merelcht
Copy link
Member

merelcht commented Jan 7, 2026

Hi @CommitToday ! I'm closing this due to inactivity. Feel free to re-open it if you want to continue working on it 🙂

@merelcht merelcht closed this Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rich logging integration mishandles Kedro node brackets and markup escaping

2 participants