Skip to content

do not configure logging on import, use named logger - #116

Merged
SkywalkerSpace merged 1 commit into
seatable:masterfrom
dracador:fix-library-logging
Sep 4, 2026
Merged

do not configure logging on import, use named logger#116
SkywalkerSpace merged 1 commit into
seatable:masterfrom
dracador:fix-library-logging

Conversation

@dracador

@dracador dracador commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

convert_airtable.py was configuring the logger for the root level, which clashes with other loggers that are properly configured via a logging dict, like how it's done normally in applications like django.

In applications that configure their own logging this caused duplicated log lines and third-party output in seatable's format.

It should be possible to toggle only the seatable_api log on explicitly if it's needed.

In general, libraries should only configure their own named logging space.
See https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library

`convert_airtable.py` was configuring the logger for the root level,
which clashes with other loggers that are properly configured via a
logging dict, like how it's done normally in applications like django.

In applications that configure their own
logging this caused duplicated log lines and third-party output in
seatable's format.

It should be possible to toggle seatable_api logging on explicitly if it's needed.

In general, libraries should only configure their own named logging space.
See https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library

@seafile-dev seafile-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: Comment

Warnings:

  • 缺少覆盖本次日志隔离行为的回归测试;已在行内评论说明。
    Suggested fix: 新增独立进程测试,断言导入 seatable_api.convert_airtable 不调用 logging.basicConfig、不修改 root logger,并且模块 logger 名称位于 seatable_api 命名空间。

Comment thread seatable_api/convert_airtable.py
@SkywalkerSpace
SkywalkerSpace merged commit b9de89f into seatable:master Sep 4, 2026
1 check passed
@dracador
dracador deleted the fix-library-logging branch September 4, 2026 11:29
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