Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log errors in a file

Tags:

erlang

How do I log all process crashes into a file instead of a tty ? I've read in the documentation that there are some standard Erlang modules that can do it (SASL, error_logger), but unfortunately haven't found any clean examples.

like image 289
Konstantin Avatar asked Mar 23 '10 13:03

Konstantin


People also ask

What is a log file error?

The error log file contains errors the server has encountered since the log file was created; it also contains informational messages about the server, such as when the server was started. Unsuccessful user authentication is also recorded in the error log.

How can we log error messages to a file?

Approach 1: The error_log() function can be used to send error messages to a given file. First argument to the function is the error message to be sent. Second argument tells where to send/log the error message. In this case, second argument is set to 3, used to redirect error message to a file.


1 Answers

Start your erl node with

erl -boot start_sasl -sasl sasl_error_logger \{file,\"path/to/logfile.log\"\}
like image 72
gleber Avatar answered Sep 26 '22 04:09

gleber