Skip to content

Replace System.out with debug-level logging in ParagraphManager#6632

Open
sumitvairagar wants to merge 1 commit into
spring-projects:mainfrom
sumitvairagar:fix/paragraph-manager-stdout-logging
Open

Replace System.out with debug-level logging in ParagraphManager#6632
sumitvairagar wants to merge 1 commit into
spring-projects:mainfrom
sumitvairagar:fix/paragraph-manager-stdout-logging

Conversation

@sumitvairagar

Copy link
Copy Markdown

The ParagraphManager constructor unconditionally calls printParagraph(this.rootParagraph, System.out), dumping the entire PDF outline to stdout on every ParagraphPdfDocumentReader instantiation.

This cannot be controlled through logging configuration and produces noisy output when processing multiple PDFs.

Changes:

  • Replace System.out usage with Commons Logging at DEBUG level
  • Add isDebugEnabled() guard to avoid tree traversal when not needed
  • Rename printParagraphlogParagraph to reflect new behavior
  • Add regression test verifying no stdout output during initialization

The logging pattern matches sibling classes PagePdfDocumentReader and ForkPDFLayoutTextStripper.

Fixes #6599

The ParagraphManager constructor unconditionally prints the PDF
document outline (Table of Contents) to System.out via
printParagraph(). This pollutes application logs and cannot be
controlled through logging configuration.

Replace the System.out usage with a debug-level log guard using
Commons Logging, consistent with sibling classes
PagePdfDocumentReader and ForkPDFLayoutTextStripper. Add a
regression test verifying no stdout output during initialization.

Fixes spring-projects#6599

Signed-off-by: sumitvairagar <sumit.vairagar@gmail.com>
@sdeleuze sdeleuze self-assigned this Jul 16, 2026
@sdeleuze sdeleuze added this to the 2.0.1 milestone Jul 16, 2026
@sdeleuze sdeleuze added enhancement New feature or request and removed status: waiting-for-triage labels Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ParagraphPdfDocumentReader unconditionally prints PDF Table of Contents to stdout

3 participants