Browse Source

Merge pull request #1819 from pbiering/fix-1817

Fix for 1817
Peter Bieringer 8 months ago
parent
commit
a957871928
2 changed files with 8 additions and 1 deletions
  1. 1 0
      CHANGELOG.md
  2. 7 1
      radicale/log.py

+ 1 - 0
CHANGELOG.md

@@ -6,6 +6,7 @@
 * Improve: add details about platform and effective user on startup
 * Improve: display owner+permissions on directories on startup, extend error message in case of missing permissions
 * Feature: add hook for server-side e-mail notification
+* Fix: logging ignores not retrievable get_native_id if not supported by OS
 
 ## 3.5.4
 * Improve: item filter enhanced for 3rd level supporting VALARM and honoring TRIGGER (offset or absolute)

+ 7 - 1
radicale/log.py

@@ -77,7 +77,13 @@ class IdentLogRecordFactory:
                 ident += "/%s" % (record.threadName or "unknown")
             if (sys.version_info >= (3, 8) and
                     record.thread == threading.get_ident()):
-                tid = threading.get_native_id()
+                try:
+                    tid = threading.get_native_id()
+                except AttributeError:
+                    # so far function not existing e.g. on SunOS
+                    # see also https://docs.python.org/3/library/threading.html#threading.get_native_id
+                    tid = None
+
         record.ident = ident  # type:ignore[attr-defined]
         record.tid = tid  # type:ignore[attr-defined]
         return record