合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
错误日志记录器会产生几种类型的报告: Supervisor报告 在Supervisor启动或者停止被监管的进程时 Progress报告 每次OTP监管进程启动或者停止的时候会产生这个报告。 Crash报告 当被监管的进程退出时,如果它的退出原因不是normal或者shutdown,就会产生这个报告。 这三种报告是自动产生的,程序员无需关心。除此之外,当程序显式调用error_handler的方法时,也会产生三种日志报告。通过这三种报告,程序可以记录错误,警报以及提示信息。在这里,这三个术语并没有什么特别的语意,仅仅是程序员可以使用的三种标签,用来标明错误日志条目的自然属性(也就是说,想怎么用,随你)。 $erl -boot start_sasl -config elog1 注意 -config filename 不能使用全名称 elog1.config ```config elog1.conf {sasl, [ {sasl_error_logger, {file, "log/sasl-error.log"}}, {errlog_type, error}, {error_logger_mf_dir, "log/sasl"}, % Log directory {error_logger_mf_maxbytes, 10485760}, % 10 MB max file size {error_logger_mf_maxfiles, 5} % 5 files max ]}, ``` sasl_error_logger 错误信息的显示点 false:不显示,只有错误报告会被记录,进程报告之类的全部被忽略掉,而且所有的错误报告都在shell当中 tty:控制台 {file,File}:写到文件 errlog_type error:错误信息 progress:进程信息 all:所有信息 产品化环境: ```conf elog1.conf [{sasl, [ % minimise shell error logging {sasl_error_logger, false}, %only report errors {error_type, error}, %define the parameters of the rotating log %the log file directory {error_logger_mf_dir, "/home/joe/error_logs"}, % bytes per logfile {error_logger_mf_maxbytes, 10485760}, %10MB %maximum number of {error_logger_mf_maxfiles, 10} ]}]. ``` ```erlang rb:help(). rb:start([{max, 20}]). rb:list(). rb:show(1). rb:grep(RegExp). ```