erlangchicagoboss

Where does the log goes when error_logger:info_msg/2 is used


I'm using Erlang and Chicagoboss. When I am connected to localhost, I can see the log in server console. Where I run sh init-dev.sh.But in production mode I guess project runs as a daemon. Does anyone know where I can see the logs written by the statement error_logger:info_msg/2.

error_logger:info_msg(" SomeVaraiable : - ", [SomeVaraiable]),

Solution

  • You can see them in log/console.log. Try:

    tail -f log/console.og
    

    Also, error_logger takes format string similar to io:format. To print your variable it is best to use:

    error_logger:info_msg("SomeVaraiable = ~p.", [SomeVaraiable]),
    

    Your version would cause "FORMAT ERROR". ~p formatter is like "pretty print" and you have to have one for each Variable in the list, that is second argument to info_msg. I also like displaying variables for debugging purpose in format:

    Variable = actual_content_of_variable.
    

    Because this way, I am able to copy them from logs and paste it to Erlang console to do some further investigation (it is mostly useful in development mode, though).