ramitkataria commented on code in PR #50329:
URL: https://github.com/apache/airflow/pull/50329#discussion_r2085625899


##########
airflow-core/src/airflow/models/connection.py:
##########
@@ -498,7 +497,7 @@ def get_connection_from_secrets(cls, conn_id: str) -> 
Connection:
                     SecretCache.save_connection_uri(conn_id, conn.get_uri())
                     return conn
             except Exception:
-                log.debug(
+                log.exception(

Review Comment:
   I originally changed this to log.debug in PR #47648 because I misunderstood 
the behaviour. `secrets_backend.get_connection` returns `None` for "not found" 
cases and throws exceptions only for actual errors as far as I can tell. I 
encountered an issue with fernet keys where not logging the exception hid the 
actual error, showing only "Unable to retrieve connection from secrets backend 
(%s). Checking subsequent secrets backend." without any stack trace or error 
details which made it appear like the connection was just missing.
   
   Using log.exception ensures that when there's a genuine error accessing a 
secrets backend (not just a missing connection), we get the full error details 
for debugging. We could also just set `exc_info` to True and keep using 
`log.debug` but this seems important enough for most users to know in case 
they're running into an issue where the connection exists but airflow can't 
find it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to