错误记录器和 sasl 报告在 shell 上显示双重 - 如何仅查看格式化版本
当我使用 shell 启动应用程序时,我会看到所有 error_logger 报告两次。
一个版本的格式类似于 ~p
,还有一个格式很好的版本:
{info_report,<0.48.0>,
{<0.425.0>,std_info,
[{chan,ser_200},
usb_port,send,
{data,"6d e1 00 00 00 04 00 00 06 8f"}]}}
=INFO REPORT==== 8-Apr-2011::16:43:24 ===
chan: ser_200
usb_port
send
data: "6d e1 00 00 00 04 00 00 06 8f"
如何摆脱这种多余的显示?
澄清一下,我想在屏幕上看到的只是:
=INFO REPORT==== 8-Apr-2011::16:43:24 ===
chan: ser_200
usb_port
send
data: "6d e1 00 00 00 04 00 00 06 8f"
我不是在询问将其写入文件。这已经通过 mf
记录器完成了。
我想要改进的是屏幕上的实时显示。
我像这样启动 Erlang:
erl +W w -boot start_sasl -config myconfig ...
应用程序配置文件如下所示:
[{sasl, [
{sasl_error_logger, tty},
{error_logger_mf_dir,"./log"},
{error_logger_mf_maxbytes,10485760}, % 10 MB
{error_logger_mf_maxfiles, 10}]}].
When I start my application with the shell I see all error_logger reports twice.
One version is formatted like with ~p
and the there is the nicely formatted one:
{info_report,<0.48.0>,
{<0.425.0>,std_info,
[{chan,ser_200},
usb_port,send,
{data,"6d e1 00 00 00 04 00 00 06 8f"}]}}
=INFO REPORT==== 8-Apr-2011::16:43:24 ===
chan: ser_200
usb_port
send
data: "6d e1 00 00 00 04 00 00 06 8f"
How can I get rid of this redundant display?
To clarify, what I would like to see on the screen is only:
=INFO REPORT==== 8-Apr-2011::16:43:24 ===
chan: ser_200
usb_port
send
data: "6d e1 00 00 00 04 00 00 06 8f"
I'm not asking about writing it to a file. This is alredy done with the mf
logger.
What I want to improve is the live display on the screen.
I'm starting Erlang like this:
erl +W w -boot start_sasl -config myconfig ...
Application config file looks like this:
[{sasl, [
{sasl_error_logger, tty},
{error_logger_mf_dir,"./log"},
{error_logger_mf_maxbytes,10485760}, % 10 MB
{error_logger_mf_maxfiles, 10}]}].
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
刚刚发现:
在另一个项目中,我自己的一个错误处理程序中存在一个被忽视的catch all子句:
这会导致类似于输出的
~p
...因为我正在使用~p
。一旦我删除了 io:format/2 调用,双重打印就消失了。
Just found it out:
There was a overlooked catch all clause in one of my own error handlers left over from ancient times in another project:
This cause the
~p
like output ... because I'm using~p
.Once I removed the
io:format/2
call the double printing disappeared.