adoroszlai opened a new pull request, #8873:
URL: https://github.com/apache/ozone/pull/8873

   ## What changes were proposed in this pull request?
   
   LogLevel servlet does not work in Ozone:
   
   ```
   $ curl 
"http://localhost:9876/logLevel?log=org.apache.hadoop.hdds.server.events.EventQueue";
   ...
   Sorry, setting log level is only supported for log4j loggers.
   ```
   
   Thus neither does `ozone daemonlog` (does not get or set log level):
   
   ```
   $ ozone daemonlog -getlevel scm:9876 
org.apache.hadoop.hdds.server.events.EventQueue
   Connecting to 
http://scm:9876/logLevel?log=org.apache.hadoop.hdds.server.events.EventQueue
   Submitted Class Name: org.apache.hadoop.hdds.server.events.EventQueue
   Log Class: org.slf4j.reload4j.Reload4jLoggerAdapter
   
   $ ozone daemonlog -setlevel scm:9876 
org.apache.hadoop.hdds.server.events.EventQueue DEBUG
   Connecting to 
http://scm:9876/logLevel?log=org.apache.hadoop.hdds.server.events.EventQueue&level=DEBUG
   Submitted Class Name: org.apache.hadoop.hdds.server.events.EventQueue
   Log Class: org.slf4j.reload4j.Reload4jLoggerAdapter
   Submitted Level: DEBUG
   ```
   
   The problem is that Ozone uses SLF4J v2, while `LogLevel` servlet from 
Hadoop only accepts v1's `LoggerAdapter` implementation 
(`org.slf4j.impl.Reload4jLoggerAdapter`).
   
   This change copies and modifies `LogLevel` class from Hadoop.
   
   https://issues.apache.org/jira/browse/HDDS-13511
   
   ## How was this patch tested?
   
   Tested `ozone insight logs` and `ozone daemonlog` commands:
   
   ```
   $ ozone insight logs scm.event-queue
   [SCM] 2025-07-28 12:00:23,469 
[DEBUG|org.apache.hadoop.hdds.server.events.EventQueue|EventQueue] Delivering 
[event=Datanode_Command_Queue_Updated] to executor/handler 
DatanodeCommandQueueUpdatedForDatanodeCommandCountUpdatedHandler: 
DatanodeDetails
   [SCM] 2025-07-28 12:00:23,470 
[DEBUG|org.apache.hadoop.hdds.server.events.EventQueue|EventQueue] Delivering 
[event=Container_Report] to executor/handler 
ContainerReportForContainerReportHandler: ContainerReportFromDatanode
   [SCM] 2025-07-28 12:00:28,468 
[DEBUG|org.apache.hadoop.hdds.server.events.EventQueue|EventQueue] Delivering 
[event=Datanode_Command_Queue_Updated] to executor/handler 
DatanodeCommandQueueUpdatedForDatanodeCommandCountUpdatedHandler: 
DatanodeDetails
   [SCM] 2025-07-28 12:00:33,468 
[DEBUG|org.apache.hadoop.hdds.server.events.EventQueue|EventQueue] Delivering 
[event=Datanode_Command_Queue_Updated] to executor/handler 
DatanodeCommandQueueUpdatedForDatanodeCommandCountUpdatedHandler: 
DatanodeDetails
   ^C
   
   $ ozone daemonlog -getlevel scm:9876 
org.apache.hadoop.hdds.server.events.EventQueue
   Connecting to 
http://scm:9876/logLevel?log=org.apache.hadoop.hdds.server.events.EventQueue
   Submitted Class Name: org.apache.hadoop.hdds.server.events.EventQueue
   Log Class: org.slf4j.reload4j.Reload4jLoggerAdapter
   Effective Level: INFO
   
   $ ozone daemonlog -setlevel scm:9876 
org.apache.hadoop.hdds.server.events.EventQueue DEBUG
   Connecting to 
http://scm:9876/logLevel?log=org.apache.hadoop.hdds.server.events.EventQueue&level=DEBUG
   Submitted Class Name: org.apache.hadoop.hdds.server.events.EventQueue
   Log Class: org.slf4j.reload4j.Reload4jLoggerAdapter
   Submitted Level: DEBUG
   Setting Level to DEBUG ...
   Effective Level: DEBUG
   ```
   
   https://github.com/adoroszlai/ozone/actions/runs/16570969441


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to