Bug 58476 - univention.management.console.log sets the global log level to DEBUG on import
Summary: univention.management.console.log sets the global log level to DEBUG on import
Status: NEW
Alias: None
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
Version: UCS 5.2
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: UMC maintainers
QA Contact: UMC maintainers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-17 13:57 CEST by Jürn Brodersen
Modified: 2025-07-17 14:22 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Customer ID:
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jürn Brodersen univentionstaff 2025-07-17 13:57:05 CEST
Is this intentional? This seems wrong.

I noticed this, because I was wondering why our Selenium tests were logging at debug level, even though I never requested them to do so.

https://git.knut.univention.de/univention/dev/ucs/-/blob/5.2-2/management/univention-management-console/src/univention/management/console/log.py?ref_type=heads#L111

Note:
the global handler in the next line also seems weird to me, and results duplicated log lines
https://git.knut.univention.de/univention/dev/ucs/-/blob/5.2-2/management/univention-management-console/src/univention/management/console/log.py?ref_type=heads#L112

Stack trace I used for debugging, in case it comes in handy: 
```
File "/usr/lib/python3/dist-packages/ucsschool/lib/models/user.py", line 299, in create
    return super(User, self).create(lo=lo, validate=validate)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/base.py", line 554, in create
    success = self.create_without_hooks(lo, validate)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/base.py", line 584, in create_witho
ut_hooks
    self.do_create(udm_obj, lo)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/user.py", line 313, in do_create
    subdir = self.get_roleshare_home_subdir()
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/user.py", line 138, in get_roleshar
e_home_subdir
    from ucsschool.lib.roleshares import roleshare_home_subdir
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/ucsschool/lib/roleshares.py", line 45, in <module>
    from ucsschool.lib.school_umc_ldap_connection import MACHINE_READ, USER_READ, USER_WRITE, L
DAP_Connection
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/ucsschool/lib/school_umc_ldap_connection.py", line 45, in <module>
    from univention.management.console.log import MODULE
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/univention/management/console/log.py", line 111, in <module>
    CORE.root.setLevel(logging.DEBUG)
  File "/usr/lib/python3.11/sitecustomize.py", line 16, in traced_setLevel
    traceback.print_stack()
```
Comment 1 Florian Best univentionstaff 2025-07-17 14:22:36 CEST
This was also the case prior to Bug #55324 in log.py:

        self._fallbackLogger = logging.getLogger('UMC.%s' % id) 
        self._fallbackLogger.setLevel(logging.DEBUG)
        self._fallbackLogger.addHandler(fallbackLoggingHandler)

which was executed during import-time.

But no, this is not intentionally. We should just remove it or set it to the logging-default.