[erlang-questions] how: logging messages to another node

Ulf Wiger (TN/EAB) <>
Thu Nov 1 16:21:22 CET 2007


Jay Nelson wrote:
> Serge wrote:
> 
>  > Hmm, seems like this is what you want to do:
>  >      rpc:call(Node, erlang, whereis, [error_logger]).
> 
> Doh!   I never use rpc: so it didn't occur to me at all that any  
> function I use locally can be trivially invoked using rpc:call.  That  
> is a good tool when coordinating activity between two nodes.

Just spend some time meditating over the use of group_leader() in
error_logger, the io system and rpc. When you use rpc:call(), the
remote process spawned to service the call is given the same
group leader as the caller. The point is to make printouts appear
on the caller's node. The error_logger_tty_h handler looks at the
group leader of the origin and skips it if the group leader is
from another node.

When I tried it, the error report appeared on both nodes. It's
a mystery that I didn't fully unravel.

BR,
Ulf W



More information about the erlang-questions mailing list