def METHOD_NAME(caplog):
    caplog.set_level(logging.INFO)
    (
        mock_native_cursor,
        mock_managed_cursor,
        _,
        _,
        mock_connection_hook_spec,
    ) = populate_mock_managed_cursor()
    exception = Exception("Mock exception")
    mock_native_cursor.execute.side_effect = [exception]
    mock_connection_hook_spec.db_connection_recover_operation.side_effect = [exception]
    with pytest.raises(Exception):
        mock_managed_cursor.execute(_query)
    assert "Failed query duration 00h:00m:" in str(caplog.records)