Skip to content

Commit 084d78f

Browse files
committed
Simplify the SQLA debug logging
1 parent bd435b5 commit 084d78f

File tree

1 file changed

+1
-11
lines changed
  • airflow-core/src/airflow/utils

1 file changed

+1
-11
lines changed

airflow-core/src/airflow/utils/db.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -715,23 +715,13 @@ def _setup_debug_logging_if_needed():
715715
return
716716

717717
import faulthandler
718-
import threading
719718

720719
# Enable SQLA debug logging
721720
logging.getLogger("sqlalchemy.engine").setLevel(logging.DEBUG)
722721

723722
# Enable Fault Handler
724723
faulthandler.enable(file=sys.stderr, all_threads=True)
725-
726-
# Print Active Threads and Stack Traces Periodically
727-
def dump_stacks():
728-
while True:
729-
for thread_id, frame in sys._current_frames().items():
730-
log.info("\nThread %s stack:", thread_id)
731-
traceback.print_stack(frame)
732-
time.sleep(300)
733-
734-
threading.Thread(target=dump_stacks, daemon=True).start()
724+
faulthandler.dump_traceback_later(timeout=300, repeat=True, file=sys.stderr)
735725

736726

737727
@provide_session

0 commit comments

Comments
 (0)