Running the report browser (rb) for SASL error reports whilst in a remote shell

被刻印的时光 ゝ 提交于 2019-12-21 20:47:54

问题


Folks we are now delploying a lot of Erlang instances and we are seeing bugs been thrown and would like to examine them...

Normally we connect to the running instance with a remote shell and get access to an Erlang console that way, but this doesn't work for rb or error messages...

How do I get remote access to my SASL error messages without dropping the server, starting it non-detached and looking at the shell?


回答1:


I ran into this back in R11B and ended up creating a clone of rb that works over a remote shell (http://github.com/archaelus/erms/blob/master/src/erms_rb.erl). The trick is to discover the group_leader of the caller and then send output there.

I should probably tidy that up and submit it as a patch to rb.




回答2:


I start my remote shell via -remsh (${ROOTDIR}/bin/erl -name shell@${NODE_IP} -remsh ${NODE_NAME}). once there I set the rb_server group_leader to the current group_leader of the shell and rb henceforth prints its output to the active shell:

(cacherl@192.168.2.31)1> rb:start().
{ok,<0.213.0>}
(cacherl@192.168.2.31)2> group_leader(group_leader(),erlang:whereis(rb_server)).
true
(cacherl@192.168.2.31)3> rb:show(1).

PROGRESS REPORT  <0.77.0>                                   2011-01-28 17:49:23
===============================================================================
supervisor                                                     {local,sasl_sup}
started
         [{pid,<4543.96.0>},
         {name,rb_server},
         {mfargs,{rb,start_link,[[]]}},
         {restart_type,temporary},
         {shutdown,brutal_kill},
         {child_type,worker}]

ok
(cacherl@192.168.2.31)4> 

EDIT: encapsulate it in a function for convenience:

%% @doc Start the report browser and reset its group-leader. 
%% For use in a remote shell
start_remote_rb() ->
    {ok, Pid} = rb:start(),
    true = erlang:group_leader(erlang:group_leader(), Pid),
    ok.

regards, Tom




回答3:


I haven't used rb, so I don't know much about it, but maybe this will help you anyway:

You can set SASLs error report handler to write to disk, see http://www.erlang.org/doc/man/sasl_app.html :

sasl_error_logger = Value <optional>

Value is one of:

...

{file,FileName}

Installs sasl_report_file_h in the error logger. This makes all reports go to the file FileName. FileName is a string.

...

I also dimly remember there being a way to install a custom handler callback, but I can't seem to find it right now, unfortunately.



来源:https://stackoverflow.com/questions/2355744/running-the-report-browser-rb-for-sasl-error-reports-whilst-in-a-remote-shell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!