Skip to content

Commit

Permalink
Fix log propagation issue (#498)
Browse files Browse the repository at this point in the history
We were not propagating logs, which led to people who had custom log
handlers to miss Cosmos events.

Closes: #476
  • Loading branch information
tatiana authored Aug 30, 2023
1 parent 53dbb38 commit a0c012f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 0 additions & 1 deletion cosmos/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def get_logger(name: str | None = None) -> logging.Logger:
[2023-08-09T14:20:55.532+0100] {subprocess.py:94} INFO - (astronomer-cosmos) - 13:20:55 Completed successfully
"""
logger = logging.getLogger(name)
logger.propagate = False
formatter: logging.Formatter = CustomTTYColoredFormatter(fmt=LOG_FORMAT) # type: ignore
handler = logging.StreamHandler()
handler.setFormatter(formatter)
Expand Down
1 change: 1 addition & 0 deletions tests/test_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ def test_get_logger():
assert custom_string not in standard_logger.handlers[0].formatter._fmt

custom_logger = get_logger("cosmos-log")
assert custom_logger.propagate is True
assert custom_logger.handlers[0].formatter.__class__.__name__ == "CustomTTYColoredFormatter"
assert custom_string in custom_logger.handlers[0].formatter._fmt

0 comments on commit a0c012f

Please sign in to comment.