Erlang: Why don't I see error_logger:info_msg output when connected by remsh?
I connect to a running node with the -remsh flag, and I run my usual Common Test sanity tests, but none of the error_logger:info_msg message开发者_C百科s appear in the shell. Why?
The SASL default event handler will only write events to console/tty of the local node. When connecting via "-remsh", you're starting a second node and communicating via message passing to the first. The output from the "nodes()" BIF can confirm this.
Calls to the error_logger functions will send events to the local 'error_logger' registered process, which is a gen_event server. You can manipulate it using error_logger:tty/1 and error_logger:logfile/1, see the reference docs in the "Basic" Application Group, then the "kernel" application, then the "error_logger" module.
You can also add your own event handler to the 'error_logger' server, which can then do anything you want with the event. I'd guess that error_logger:logfile/1 might be sufficient for your purposes, though.
-Scott
精彩评论