list_to_atom use in kernel/error_logger.erl

Gunilla Arendt <>
Thu Feb 2 14:21:45 CET 2006


Serge Aleynikov wrote:
> 
> Thank you for clarification.  The reason I looked into the 
> error_logger's code was indeed related to the ugly format of the 
> displayed message upon an unsuccessful startup with a -boot option.
> 
> Though I still don't understand the need for list_to_atom(L) there.  Why 
> not just return the list L?  It does work either way.
> 

I haven't tried to verify this, but my guess would be that someone tried
to make the output from error_logger more readable in the case where
the Erlang run-time system fails to start.

For example, if an application in the boot script fails to start, you
will see something like this:

$ erl
{error_logger,{{2006,2,2},{14,11,52}},'Protocol: ~p: register error: 
~p~n',[inet_tcp,{{badmatch,{error,duplicate_name}},[{inet_tcp_dist,listen,1},{ne
t_kernel,start_protos,4},{net_kernel,start_protos,3},{net_kernel,init_node,2},{n
et_kernel,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]}]}
...

which is of course somewhat more readable than

{error_logger,{{2006,2,2},{14,11,52}},[80,114,111,116,111,99,111,108,58,32,126,1
12,58,32,114,101,103,105,115,116,101,114,32,101,114,114,111,114,58,32,126,112,12
6,110],[inet_tcp,{{badmatch,{error,duplicate_name}},[{inet_tcp_dist,listen,1},{ne
t_kernel,start_protos,4},{net_kernel,start_protos,3},{net_kernel,init_node,2},{n
et_kernel,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]}]}
...

/ Gunilla





More information about the erlang-questions mailing list