简体   繁体   中英

how to change the log level of apache flink at runtime

Is it possible to change the log level of the flink framework at runtime? when flink cluster is already running? I referred to the below document there is no such mention about it

https://ci.apache.org/projects/flink/flink-docs-stable/monitoring/logging.html

In the program code, Flink uses SLF4J for logging and supports log4j (log4j2 for Flink>= 1.11, log4j < 1.11) and Logback as underlying logging frameworks, which can be freely configured via their respective .properties files.

As far as I can tell, SLF4J itself doesn't support changing the logging level at runtime and in Flink itself, I see no custom code related to the underlying logging framework like log4j or logback which would change the loglevel via some mechanism like a REST API.

That said, the log framework itself might allow for some mechanism to change the log level at runtime. On a short google search, I find that for instance log4j has some mechanisms included eg by using File Watchdog and reload logging properties files at runtime, see for example here: Dynamically Changing log4j log level Of course, you would need to build the tooling around that yourself, ie find out where your TaskManagers and JobManagers are running, have their working directory and provide/edit the files accordingly.

Conclusion: I'd suggest you to stop your job with a savepoint, change the logging properties and restart the job. That's probably the easier way to go..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM