Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress everest logger output to the console #9371

Merged
merged 2 commits into from
Nov 29, 2024
Merged

Suppress everest logger output to the console #9371

merged 2 commits into from
Nov 29, 2024

Conversation

verveerpj
Copy link
Contributor

Issue
Resolves #9269

Approach
Redo logging setup using dict configuration, which mysteriously fixes the issue.

  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure unit tests pass locally after every commit (git rebase -i main --exec 'pytest tests/ert/unit_tests -n logical -m "not integration_test"')

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Create Backport PR to latest release

@verveerpj verveerpj self-assigned this Nov 27, 2024
@verveerpj verveerpj marked this pull request as draft November 27, 2024 15:10
@verveerpj verveerpj force-pushed the fix-loggin branch 2 times, most recently from b666b8a to ad6861b Compare November 27, 2024 15:37
@verveerpj
Copy link
Contributor Author

Unfortunately, it has proven difficult to write a test for this, because pytest interferes with the logging. It is possible to manipulate that with the caplog fixture, but that seemed to not work nicely with the capsys fixture, which is needed to check the output for console.

Therefore I will not write a test. If we experience a regression with this issue, it will become evident immediately since it will show up in the console.

@verveerpj verveerpj marked this pull request as ready for review November 28, 2024 09:55
log_level=logging.INFO,
)
def _configure_loggers(config: EverestConfig) -> None:
def _make_handler(path: Path, log_level: str | int = "INFO") -> dict[str, Any]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpicky comment: I would rename this to make_handler_config

)
detached_dir = Path(ServerConfig.get_detached_node_dir(config.output_dir))
log_dir = Path(config.log_dir)
logging_dict = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you consider naming this logging_config?

src/everest/detached/jobs/everserver.py Show resolved Hide resolved
file_path=os.path.join(detached_node_dir, "endpoint.log"),
log_level=logging.INFO,
)
def _configure_loggers(config: EverestConfig) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible for this function to only get the required components from EverestConfig and not the entire object?

Copy link
Contributor

@DanSava DanSava left a comment

Choose a reason for hiding this comment

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

Thank you ❤️

@verveerpj verveerpj merged commit d176350 into main Nov 29, 2024
41 checks passed
@verveerpj verveerpj deleted the fix-loggin branch November 29, 2024 07:15
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.

DEBUG and INFO logging bleeding to console, should be only added to the log files
2 participants