Search code examples
erlangerror-loggingsaslerlang-shell

Why Erlang sasl application doesn't save my log files correctly?


I booted the Erlang shell with sasl started and with the following configuration file, but it doesn't create an error log on disk:

%% rotating log and minimal tty
[{sasl, [
 {sasl_error_logger, false},    
 %% define the parameters of the rotating log
 %% the log file directory
 {error_logger_mf_dir,"ErrorLogger/erLog"}, 
     %% # bytes per logfile
 {error_logger_mf_maxbytes,10485760}, % 10 MB
     %% maximum number of logfiles
 {error_logger_mf_maxfiles, 10}
]}].

However if I place "." as the directory value, it creates unnamed logs on disk: {error_logger_mf_dir,"."}


Solution

  • You must provide absolute or relative address for error_logger_mf_dir config.

    Absolute:

     %% the log file absolute directory
     {error_logger_mf_dir,"/path/to/ErrorLogger/erLog"}, 
    

    Relative:

     %% the log file based on current directory
     {error_logger_mf_dir,"./ErrorLogger/erLog"}, 
     %% Also it must work
     {error_logger_mf_dir,"ErrorLogger/erLog"}, 
    

    Note: Make sure that your Erlang application has write access to ErrorLogger/erLog directory. If so sasl will create there one file called index, and report files 1, 2, 3 and so on which should be browsed by the Report Browser (rb) tool.