Skip to content

Support passing LoggerAdapter objects to LogStream#3547

Merged
jsiirola merged 2 commits intoPyomo:mainfrom
jsiirola:logstream-loggeradapter
Mar 31, 2025
Merged

Support passing LoggerAdapter objects to LogStream#3547
jsiirola merged 2 commits intoPyomo:mainfrom
jsiirola:logstream-loggeradapter

Conversation

@jsiirola
Copy link
Copy Markdown
Member

@jsiirola jsiirola commented Mar 31, 2025

Fixes # .

Summary/Motivation:

@michaelbynum noted that capture_output was not compatible with LogStreams that pointed to logging.LoggerAdapter objects (this was generating exceptions in IDAES). This resolves that limitation.

Changes proposed in this PR:

  • LogStream.redirect_streams(): resolve LoggerAdapter objects to their underlying Logger before looking for handlers.

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@jsiirola jsiirola requested a review from michaelbynum March 31, 2025 14:12
Copy link
Copy Markdown
Contributor

@michaelbynum michaelbynum left a comment

Choose a reason for hiding this comment

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

Looks good, assuming tests pass. Thanks, @jsiirola!

@mrmundt mrmundt changed the title Suppert passing LoggerAdapter objects to LogStream Support passing LoggerAdapter objects to LogStream Mar 31, 2025
@jsiirola jsiirola merged commit 0767329 into Pyomo:main Mar 31, 2025
35 checks passed
@jsiirola jsiirola deleted the logstream-loggeradapter branch March 31, 2025 16:02
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.

3 participants