1.SASL is an application, an important function of SASL is to record the system process related logs, such as process start, end, crash errors and other information. The log function of SASL is based on the log module Error_logger with Erlang. I briefly introduce the use of SASL.
The following 3 error handling are defined in SASL:
Sasl_report_tty_h: Output logs to the console
Sasl_report_file_h: Output logs to a single file
Error_logger_mf_h: Circular log file record
SASL Log Configuration parsing sample files Elog.config
[{SASL, [
Percent minimise shell error logging
{Sasl_error_logger, false},
Percent Errors
{errlog_type, error},
Percent define the parameters of the rotating log
Percent of the log file directory
{Error_logger_mf_dir, "./logs"},
Percent percent # bytes per logfile
{error_logger_mf_maxbytes,10485760},% MB
< Span style= "font-size:14pt" > %% maximum number of & nbsp
{error_logger_mf_maxfiles, ten} ]}].
The above configuration can actually be divided into two groups
1). Output to the console or a single file Sasl_error_logger, Errlog_type, this set of configuration for Sasl_report_tty_h, sasl_report_file_h These two log processors valid
Sasl_error_logger false|tty| {file,file}| {file, FileName, Modes} default TTY errlog_type error|progress|all, default all
2). Output to circular log file error_logger_mf_dir log directory error_logger_mf_maxbytes log file size
Error_logger_mf_maxfiles Number of log files
The above two sets of configurations are independent of each other, you can specify the configuration file when you start Erlang
$erl-boot Start_sasl-config Elog
START_SASL is a boot file that can be found in the installation directory of Erlang, all called Start_sasl.boot, Elog is the above configuration file Elog.config.
Read circular log loop log is recorded in binary format in the file, need to use the RB tool to read, RB commonly used functions are: Rb:start (Options) Start RB {max, maxnoofreports} maximum number of log entries read {Report_dir, dirstring} Specifies the directory to read the log, by default the value {type, reporttype} in the configuration item Error_logger_mf_dir reads the report of the specified type, error | error_report | info_msg | Info_report | warning_msg | Warning_report | Crash_report | Supervisor_report | Progress Rb:stop () Stop RB rescan (Options) Rescan log files list (), list (type) lists all log reports, type can specify the types of reports listed
Show shows the details of the log report, which is the number listed in list.
2. Modify the new file Emzz.erl file in the SRC folder as the entry for the project
Pass the code later ....
3.EZMM Engineering (Common shell commands, and basic dependency libraries needed)