my debug handler won't stick

Martin Bjorklund mbj@REDACTED
Tue Jan 2 11:03:02 CET 2001

"Vance Shipley" <vances@REDACTED> wrote:
> The sys module has a function to install a custom debug
> function which will be called whenever a system event is
> generated.  It is defined as:
> 	sys:install(Name, Func, FuncState) -> done | NewFuncState
> So I create a debug function like this:
> 	dbg_fun(FuncState, Event, ProcState) ->
> 		io:fwrite("~w ~w ~w~n", [FuncState, Event, ProcState]),
> 		FuncState.
> and install it with:
> 	sys:install(testing, {test, dbg_fun}, foo)

You probaly mean:

 	sys:install(testing, {{test, dbg_fun}, foo})

> Now the next time I send a message ('bar') to testing I get:
> 	foo {in, {'$gen_event', bar}} {testing, state1}
> Which is great however subsequent messages don't result in
> dbg_fun getting called.

You can check the status of you process by calling sys:get_status/1.
There you'll see if your handler is installed:

2> sys:install(error_logger, {{test, dbg_fun}, foo}).
3> sys:get_status(error_logger).
         [{{test,dbg_fun},foo}],        <-----------------

This works fine for me.


More information about the erlang-questions mailing list