[erlang-questions] Distributed application logging
Steve
steve.e.123@REDACTED
Mon Dec 28 17:49:17 CET 2009
Thanks Jayson. That seems to be working fine. It's easy to add the node
information to the head of a sasl report. So if I get an event like this
at the local node {error_report, Gleader, {Pid, Type, Report}}, I just
change it to {error_report, Gleader, {Pid, Type, [{at_node, node(Pid)} |
Report]}} before I send it via gen_event:notify to the global master
node event handler. Then on the master node I can use rb to navigate my
log that gets generated by attaching a log_mf_h handler to my global
event manager. Then I can just grep on the node using rb:grep/1.
This meets my requirement of "easy". :)
It would be great to know if anyone else has thoughts on distributed
application event logging.
Steve
Jayson Vantuyl wrote:
> I would write my own log handler that wrapped log_mf_h and recovered the node info when the event was received. Basically, just insert yourself and add the information you want.
>
> On Dec 23, 2009, at 8:48 AM, Steve wrote:
>
>> I'm hoping someone might shed some light on the best/easiest way to do distributed application event logging.
>>
>> In my app I have master node, two failover master nodes, and then a set of nodes that are coordinated by the master node and communicate with the master node via global fully qualified names. Each node will run its own application instance, vm and hardware.
>>
>> My goal is to log all standard sasl events which are generated on the local nodes (alarms, errors, progress and supervisor reports) to the central master node.
>>
>> The way I currently do this is to 1) register a global event manager on the central node and 2) send local sasl events to this global manager. I have a log_mf_h handler on the central node which I use to manage the global log. This code exists as its own application alongside my main application so I can get progress reports about the main application starting, etc.
>>
>> This all works pretty well. The only "problem" is that log_mf_h and rb don't say much about the node that generated the event. Pids are of course there, and I know I can get node info from a pid via node/1. I can probably send my own reports to log_mf_h or create my own round robin log that contains reports with info about the nodes. But I'd rather get the most out of what's already there in erlang if I can being a big fan of not reinventing the wheel.
>>
>> So... I guess my question is: am I on the right track more or less, or have I missed something in the docs/libs or my app design that would help me?
>>
>> Thanks in advance.
>>
>> Steve
>>
More information about the erlang-questions
mailing list