phanikumv commented on code in PR #68696:
URL: https://github.com/apache/airflow/pull/68696#discussion_r3434193046


##########
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"
+
+  fun threshold(): Level = parse(configuredLevel()) ?: Level.INFO

Review Comment:
   Can you test this scenario with this PR, I think it breaks.
   
   In airflow.cfg
     [logging]
     logging_level = WARNING
      
   Since it wont be in os.environ: no AIRFLOW__LOGGING__LOGGING_LEVEL set . 
Hence Java resolves to INFO.
   
   Overall Result: Java WARNING logs will be silently dropped. A Python task in 
the same deployment with the same cfg would show WARNING logs. 
   
   I think it is identical config, divergent behavior by task language .



-- 
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