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

Fix setup logging #2555

Merged
merged 2 commits into from
Jan 6, 2025
Merged

Fix setup logging #2555

merged 2 commits into from
Jan 6, 2025

Conversation

sbrunner
Copy link
Member

@sbrunner sbrunner commented Dec 9, 2024

To avoid:

  File "/usr/lib/python3.12/logging/__init__.py", line 1539, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python3.12/logging/__init__.py", line 1684, in _log
    self.handle(record)
  File "/usr/lib/python3.12/logging/__init__.py", line 1700, in handle
    self.callHandlers(record)
  File "/venv/lib/python3.12/site-packages/sentry_sdk/integrations/logging.py", line 98, in sentry_patched_callhandlers
    return old_callhandlers(self, record)
Message: '[%s] %r'
Arguments: ('cached since 570.4s ago', {'status': 'ERROR', 'status_1': 'PENDING', 'created_at_1': datetime.datetime(2024, 12, 8, 16, 4, 28, 898425, tzinfo=datetime.timezone.utc)})
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.12/logging/__init__.py", line 1163, in emit
    stream.write(msg + self.terminator)
    ^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'write'

@sbrunner sbrunner added the backport 6.1 Backport the pull request to the '6.1' branch label Dec 9, 2024
@sbrunner sbrunner requested a review from gberaudo December 9, 2024 16:06
@sbrunner sbrunner force-pushed the fix-settup-logging branch 2 times, most recently from a0d7ea4 to 651fca9 Compare December 12, 2024 07:32
@sbrunner sbrunner added backport master Backport the pull request to the 'master' branch and removed backport 6.1 Backport the pull request to the '6.1' branch labels Dec 12, 2024
@sbrunner sbrunner changed the base branch from master to 6.1 December 12, 2024 07:32
Copy link
Member

@arnaud-morvan arnaud-morvan 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

c2cwsgiutils/loader.py Outdated Show resolved Hide resolved
@sbrunner sbrunner marked this pull request as ready for review January 6, 2025 11:00
To avoid:
```
  File "/usr/lib/python3.12/logging/__init__.py", line 1539, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python3.12/logging/__init__.py", line 1684, in _log
    self.handle(record)
  File "/usr/lib/python3.12/logging/__init__.py", line 1700, in handle
    self.callHandlers(record)
  File "/venv/lib/python3.12/site-packages/sentry_sdk/integrations/logging.py", line 98, in sentry_patched_callhandlers
    return old_callhandlers(self, record)
Message: '[%s] %r'
Arguments: ('cached since 570.4s ago', {'status': 'ERROR', 'status_1': 'PENDING', 'created_at_1': datetime.datetime(2024, 12, 8, 16, 4, 28, 898425, tzinfo=datetime.timezone.utc)})
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.12/logging/__init__.py", line 1163, in emit
    stream.write(msg + self.terminator)
    ^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'write'
```
@sbrunner sbrunner force-pushed the fix-settup-logging branch from 651fca9 to 494482f Compare January 6, 2025 12:21
@sbrunner sbrunner enabled auto-merge January 6, 2025 12:22
From the artifact of the previous workflow run
@sbrunner sbrunner merged commit a55ca3d into 6.1 Jan 6, 2025
3 checks passed
@sbrunner sbrunner deleted the fix-settup-logging branch January 6, 2025 12:34
@c2c-bot-gis-ci-2 c2c-bot-gis-ci-2 removed the backport master Backport the pull request to the 'master' branch label Jan 6, 2025
@geo-ghci-int geo-ghci-int bot added this to the 6.1.6 milestone Jan 6, 2025
@arnaud-morvan
Copy link
Member

@sbrunner

Note that now I get ValueError: Can not parse args of handlers console, use kwargs instead.

with in .ini file:

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

@sbrunner
Copy link
Member Author

sbrunner commented Jan 9, 2025

args is effectively not working, see: https://github.com/camptocamp/c2cwsgiutils/releases/tag/6.1.0 :-)

@arnaud-morvan
Copy link
Member

thank @sbrunner for the tip.

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