How to receive stdio and error_logger messages on a remote shell

谁都会走 提交于 2019-12-06 02:09:18

问题


After spending a good while getting rb to work on a remote shell, I would like to get stdio / error logger messages on a remote shell, I have dug around changing group_leaders but it would seem to require changing the group_leader of all the running process, and my experiments have found that to be pretty unstable.


回答1:


The most straightforward way would be to not to mess with erlang io subsystem, but to use standard ERTS tools. 1 Start emulator with stdin/stdout wrapper/logger:

run_erl -daemon /tmp/ /some/log/dir erl

2 Then do:

ssh localhost -tt to_erl /tmp/
  1. makes emulator to start with pipes attached to stdin and stdout placed into /tmp and circular log files of stdin and stdout plus node liveness marks placed into /some/log/dir. Quick and dirty audit log for shell activity :)
  2. connects to stdin and stdout pipes. Benefit of "ssh -tt" is working completion in shell.

For more hints see "$ERL_TOP/erts*/bin/start" and man page for 'run_erl' and 'to_erl': http://www.erlang.org/doc/man/run_erl.html



来源:https://stackoverflow.com/questions/2531150/how-to-receive-stdio-and-error-logger-messages-on-a-remote-shell

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