如何更改张量板的日志记录级别?

Posted

技术标签:

【中文标题】如何更改张量板的日志记录级别?【英文标题】:how to change the logging level of tensorboard? 【发布时间】:2019-11-11 17:36:06 【问题描述】:

我在张量板的启动参数中找不到这样的选项。当我列出所有标志时,我发现是这样的:

logdir      --> .tensorboard/log_2019-06-30_18-33-18_952122
host      --> 
port      --> None
purge_orphaned_data      --> True
reload_interval      --> 5.0
db      --> 
db_import      --> False
db_import_use_op      --> False
inspect      --> False
version_tb      --> False
tag      --> 
event_file      --> 
path_prefix      --> 
window_title      --> 
max_reload_threads      --> 1
reload_task      --> auto
samples_per_plugin      --> 
debugger_data_server_grpc_port      --> -1
debugger_port      --> -1
master_tpu_unsecure_channel      --> 

在操作中,它的日志级别设置为“WARNING”,日志消息直接打印在标准输出上,结果我在编写复杂模型时看到了很多不必要的消息,如下所示:

I0630 18:33:19.152284 140581946894080 _internal.py:122] ::ffff:127.0.0.1 - - [30/Jun/2019 18:33:19] "GET / HTTP/1.1" 200 -
I0630 18:33:19.335198 140581946894080 _internal.py:122] ::ffff:127.0.0.1 - - [30/Jun/2019 18:33:19] "GET /font-roboto/oMMgfZMQthOryQo9n22dcuvvDin1pK8aKteLpeZ5c0A.woff2 HTTP/1.1" 200 -
I0630 18:33:20.419392 140581806262016 _internal.py:122] ::ffff:127.0.0.1 - - [30/Jun/2019 18:33:20] "GET /data/plugins_listing HTTP/1.1" 200 -
I0630 18:33:20.422904 140581212772096 _internal.py:122] ::ffff:127.0.0.1 - - [30/Jun/2019 18:33:20] "GET /data/environment HTTP/1.1" 200 -
I0630 18:33:20.424074 140581221164800 _internal.py:122] ::ffff:127.0.0.1 - - [30/Jun/2019 18:33:20] "GET /data/runs HTTP/1.1" 200 -
I0630 18:33:20.428111 140581204379392 _internal.py:122] ::ffff:127.0.0.1 - - [30/Jun/2019 18:33:20] "GET /data/experiments HTTP/1.1" 200 -
I0630 18:33:20.490971 140581204379392 _internal.py:122] ::ffff:127.0.0.1 - - [30/Jun/2019 18:33:20] "GET /font-roboto/RxZJdnzeo3R5zSexge8UUZBw1xU1rKptJj_0jans920.woff2 HTTP/1.1" 200 -
I0630 18:33:20.519970 140581204379392 _internal.py:122] ::ffff:127.0.0.1 - - [30/Jun/2019 18:33:20] "GET /data/plugins_listing HTTP/1.1" 200 -
I0630 18:33:20.522117 140581221164800 _internal.py:122] ::ffff:127.0.0.1 - - [30/Jun/2019 18:33:20] "GET /data/environment HTTP/1.1" 200 -
I0630 18:33:20.531321 140581212772096 _internal.py:122] ::ffff:127.0.0.1 - - [30/Jun/2019 18:33:20] "GET /data/runs HTTP/1.1" 200 -
I0630 18:33:20.533931 140581221164800 _internal.py:122] ::ffff:127.0.0.1 - - [30/Jun/2019 18:33:20] "GET /data/experiments HTTP/1.1" 200 -
I0630 18:33:20.709606 140581221164800 _internal.py:122] ::ffff:127.0.0.1 - - [30/Jun/2019 18:33:20] "GET /font-roboto/d-6IYplOFocCacKzxwXSOJBw1xU1rKptJj_0jans920.woff2 HTTP/1.1" 200 -

如何摆脱它们?

【问题讨论】:

对此有什么看法?此消息正在炸毁我们在 Jenkins 上的日志。 【参考方案1】:

我唯一要做的就是关闭整个程序的日志记录。我希望有一个更优雅的解决方案,但现在它可以避免那些烦人的刷新通知:

logging.disable(logging.ERROR)

希望这会有所帮助!

(Tensorboard 团队,请添加详细程度标志或类似内容)

【讨论】:

以上是关于如何更改张量板的日志记录级别?的主要内容,如果未能解决你的问题,请参考以下文章

如何设置日志记录级别名称?

Undertow java.util.logging:如何使用 java util logging 在运行时更改 undertow 服务器的日志记录级别

我们可以在运行时更改log4j的日志记录级别吗?

Google Cloud Profiler Java 代理的日志记录级别

更改级别记录到 IPython/Jupyter 笔记本

无法更改 Apache Jena 日志记录级别(使用 log4J2)