Skip to content

Commit a1411fd

Browse files
authored
Merge pull request #4597 from bruntib/logging_fix
[fix] Fix migration logging
2 parents a2b764f + 6e8bc9a commit a1411fd

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • web/server/codechecker_server/migrations

web/server/codechecker_server/migrations/logging.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ def setup_logger(schema: str):
6363
logger = logging.getLogger(f"migration/{schema}")
6464
logging.setLoggerClass(existing_logger_cls)
6565

66-
if not logger.hasHandlers():
66+
# logger.hasHandlers() falls back on parent's handlers, however,
67+
# logger.handlers contains the immediate handlers only. It is important to
68+
# check this list directly otherwise list indexing fails on "else" branch.
69+
if not logger.handlers:
6770
fmt = MigrationFormatter(schema)
6871
handler = logging.StreamHandler()
6972
handler.setFormatter(fmt)

0 commit comments

Comments
 (0)