[erlang-questions] how to trace gen_servers?

Matej Kosik kosik@REDACTED
Mon Nov 26 12:37:17 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

Is there a way how to customize information that gets logged into file when I turn on the
`log_to_file' option for my gen_servers?

At present, it automatically records the following information:
- - which calls given gen_server has got
- - which casts given gen_server has got
- - what did it reply back to the clients

It looks somehow this way:

*DBG* qd_frontend got call {handle_get,[{82,205,224,84},7008,3,get_ebno]} from <0.167.0>
*DBG* qd_frontend sent 9.00000 to <0.167.0>, new state
{dict,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[[{{82,205,224,84},7008},#Port<0.271>]],[],[],[],[],[],[],[]}}}
*DBG* qd_frontend got {#Port<0.271>,{data,{eol,"DD2048>"}}}
*DBG* qd_frontend new state
{dict,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[[{{82,205,224,84},7008},#Port<0.271>]],[],[],[],[],[],[],[]}}}
*DBG* qd_frontend got call {handle_get,[{82,205,224,84},7008,3,get_ebno]} from <0.167.0>
*DBG* qd_frontend sent 8.90000 to <0.167.0>, new state
{dict,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[[{{82,205,224,84},7008},#Port<0.271>]],[],[],[],[],[],[],[]}}}
*DBG* qd_frontend got {#Port<0.271>,{data,{eol,"DD2048>"}}}
*DBG* qd_frontend new state
{dict,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[[{{82,205,224,84},7008},#Port<0.271>]],[],[],[],[],[],[],[]}}}


Not very nice but partially useful. The state (dictionary) is serialized in unusable way but this is
not the primary problem.

Is there some hook I can use that I can ensure that also timestamps of these calls and casts get
printed? Because when I later observe that something bad was happening I would like to know when
those events happened.

Thanks in advance
- --
Matej Kosik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHSq/tL+CaXfJI/hgRAtKqAJ9hnjA1WWkLopFGglFdJ2KWTo97WgCgramA
iCTRY+bZg0dF3rm2uEdTITE=
=jARA
-----END PGP SIGNATURE-----



More information about the erlang-questions mailing list