jason810496 commented on code in PR #68696:
URL: https://github.com/apache/airflow/pull/68696#discussion_r3433102278
##########
java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/execution/Logger.kt:
##########
@@ -34,12 +34,58 @@ import java.util.concurrent.ConcurrentLinkedDeque
import kotlin.reflect.KClass
import kotlin.time.Clock
-enum class Level { ERROR, DEBUG, }
+// wireName is the level string the Airflow supervisor understands (structlog's
+// NAME_TO_LEVEL). It has no TRACE, so TRACE maps to "debug"; a level the
+// supervisor does not recognise is dropped silently on the Python side.
+// severity mirrors Python's logging numeric values (DEBUG=10 ... ERROR=40) so
a
+// level can be compared against the configured threshold; TRACE sits below
DEBUG.
+enum class Level(
+ val wireName: String,
+ val severity: Int,
+) {
+ TRACE("debug", 5),
+ DEBUG("debug", 10),
+ INFO("info", 20),
+ WARN("warning", 30),
+ ERROR("error", 40),
+}
+
+/**
+ * Resolves the effective task log level the JVM should emit.
+ *
+ * The supervisor reconfigures the task logger with `level_override=NOTSET`,
+ * delegating threshold filtering to the subprocess, so the Java SDK must drop
+ * sub-threshold events itself. The threshold comes from the
`airflow.logging.level`
+ * system property (an explicit JVM flag wins) and otherwise the
+ * `AIRFLOW__LOGGING__LOGGING_LEVEL` env var the subprocess inherits from the
+ * supervisor; unset or unrecognised values fall back to INFO.
+ */
+internal object LogLevel {
+ const val LEVEL_PROPERTY = "airflow.logging.level"
+ const val LEVEL_ENV = "AIRFLOW__LOGGING__LOGGING_LEVEL"
Review Comment:
Actually, I felt we should provide the `log_level` in `StartupDetails`.
I prefer to respect the Airflow side logging level, which means user might
setup custom secret backend. So we need to send from supervisor.
--
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]