Skip to content

Add logger initialization to main CLI#9577

Merged
Jintao-Huang merged 1 commit into
modelscope:mainfrom
rivergod:hotfix/no-logger-on-swift-main
Jun 17, 2026
Merged

Add logger initialization to main CLI#9577
Jintao-Huang merged 1 commit into
modelscope:mainfrom
rivergod:hotfix/no-logger-on-swift-main

Conversation

@rivergod

Copy link
Copy Markdown
Contributor

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

Fixes #9575.

This PR restores the missing logger initialization in swift/cli/main.py.

parse_yaml_args() uses logger.warning(...) when environment variables from a config file conflict with existing environment values, but logger was not defined. This adds:

from swift.utils import get_logger

logger = get_logger()

so the CLI can correctly emit the warning instead of raising a NameError.

Experiment results

No special Experiment results.

#9575

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request imports and initializes a logger in swift/cli/main.py using the get_logger utility. There are no review comments to address, and the changes are straightforward, so I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Jintao-Huang

Copy link
Copy Markdown
Collaborator

thanks!

@Jintao-Huang Jintao-Huang merged commit f658f5a into modelscope:main Jun 17, 2026
2 of 3 checks passed
@rivergod rivergod deleted the hotfix/no-logger-on-swift-main branch June 17, 2026 08:04
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.

NameError: name 'logger' is not defined in cli/main.py when using yaml config due to missing initialization

2 participants