Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4972073
  • 博文数量: 921
  • 博客积分: 16037
  • 博客等级: 上将
  • 技术积分: 8469
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-05 02:08
文章分类

全部博文(921)

文章存档

2020年(1)

2019年(3)

2018年(3)

2017年(6)

2016年(47)

2015年(72)

2014年(25)

2013年(72)

2012年(125)

2011年(182)

2010年(42)

2009年(14)

2008年(85)

2007年(89)

2006年(155)

分类: Erlang

2015-05-22 18:33:52

1.sasl日志配置解析

示例文件elog.config

 [{sasl, [ 
         %% minimise shell error logging 
         {sasl_error_logger, false}, 
         %% only report errors 
         {errlog_type, error}, 
         %% define the parameters of the rotating log 
         %% the log file directory 
         {error_logger_mf_dir,"./logs"}, 
         %% # bytes per logfile 
         {error_logger_mf_maxbytes,10485760}, % 10 MB 
         %% maximum number of 
         {error_logger_mf_maxfiles, 10} 
        ]}]. 


上面的配置实际上可以分为两组
1).输出到控制台或者单个文件sasl_error_logger 、errlog_type 
这组配置对sasl_report_tty_h、sasl_report_file_h这两个日志处理器有效
sasl_error_logger false|tty|{file,File}
errolog_type error|progress|all


2).输出到循环日志文件
error_logger_mf_dir 日志目录
error_logger_mf_maxbytes 日志文件大小
error_logger_mf_maxfiles 日志文件个数


上面两组配置是互相独立的,启动erlang时可以指定配置文件

$erl -boot start_sasl -config elog

start_sasl是一个启动文件,在erlang的安装目录下可以找到,全称为start_sasl.boot. elog就是上面的配置文件elog.config

 
2.读取循环日志
循环日志是用二进制格式记录在文件中的,需要使用rb工具读取,rb常用函数有:
rb:start(Options) 启动rb
{max, MaxNoOfReports} 读取的最大日志条数
{report_dir, DirString} 指定读取日志的目录,默认为配置项error_logger_mf_dir中的值
{type, ReportType} 读取指定类型的报告,error | error_report | info_msg | info_report | warning_msg | warning_report | crash_report | supervisor_report | progress
rb:stop() 停止rb
rescan(Options) 重新扫描日志文件
list()、list(Type) 列出所有的日志报告,Type可以指定列出的报告类型
show(Report) 显示日志报告的详细信息,Report取值为list列出的编号


原文链接
阅读(2019) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~