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

Ulf Wiger (TN/EAB) <>
Thu Nov 1 08:17:53 CET 2007


Why not just install a local handler in the error_logger
on the diskless nodes, which forwards to the backend node?

BR,
Ulf W


Jay Nelson wrote:
> I am working on a scenario with diskless nodes talking to a back end  
> node with a disk.  I want to forward error_logger messages to the  
> backend node.  Here is the chain of events:
> 
> 1) Start the diskless node
>      a) installs an event_handler to capture error_logger messages
>      b) messages are queued up until the backend node connects
> 2) Start the backend node
> 3) Detect node up and forward messages to backend
> 
> I could put a server on the backend node and forward messages to it,  
> but it seemed that there should be a way to leverage the existing  
> error_logger.  My first attempts were trying to get the process id of  
> the error_logger on another node, but there was no way to do this  
> that I could find.  I could monitor that process using {error_logger,  
> Node} but I couldn't figure out a way to remotely obtain the  
> process_id.  Is there a way?
> 
> I have a working version now, which feels a bit of a hack to me which  
> works as follows:
> 
> Backend machine:
>     - global:register_name(logger, whereis(error_logger)).
> 
> Diskless machine:
>     - Pid = global:whereis_name(logger),
>     - group_leader(Pid, self()),
>     - error_logger:error_report(Msg)
> 
> Voila, the message appears on the backend node.  I don't like the  
> idea of using the group_leader / error_logger approach or the magic  
> 'logger' global name.  It seems there should be an easier way to  
> reach out to the remote error_logger process, especially since I can  
> monitor it using the {RegName, Node}, but I can't find any other  
> functions for discovering the process_id.
> 
> Any suggestions for an alternate approach?
> 
> jay
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list