dlt本地log
需要指定APP NAME和CONTEX NAME才能保存对应的log。
1、操作过程:
在dlt.conf中打开本地log的配置项:
然后再在OfflineLogstorageDirPath路径下创建本地log规则文件:dlt_logstorage.conf
在文件中写入过滤规则:
再启动dlt-daemon -c /etc/dlt.conf -d,这样就可以让dlt针对LOG 这个app中以TEST为名的ctx的log(log等级大于DLT_LOG_WARN)都保存在/opt/test下的dlt文件中。
这个文件应该可以用dlt-veiwer打开。
2、dlt关于本地log的帮助可以在 doc/dlt_offline_logstorage.md 文件中找到。
3、帮助文档中的测试方法:
## Testing DLT Offline Logstorage
The following procedure can be used to test Offline Logstorage:
- Enable OfflineLogstorage by setting OfflineLogstorageMaxDevices = 1 in dlt.conf
- Start dlt-daemon
- The default search path of logstorage is: /tmp/dltlogs/dltlogsdevX where X is a number in the range [1..OfflineLogstorageMaxDevices]
- Create the device folder
```
$ mkdir -p /var/dltlog
```
- Create the configuration file "dlt\_logstorage.conf" in this folder and define filter configuration(s):
```
[FILTER1]
LogAppName=LOG
ContextName=TEST
LogLevel=DLT_LOG_WARN
File=example
FileSize=50000
NOFiles=5
```
- Trigger dlt-daemon to use a new device
```
$ dlt-logstorage-ctrl -c 1 -p /var/dltlog
```
- Start dlt-example-user
```
$ dlt-example-user Hello123
```
- After execution, a log file is created in /var/dltlogs
- e.g. example\_001\_20150512\_133344.dlt
- To check the content of the file open it with dlt-convert or DLT Viewer.
## Logstorage Ring Buffer Implementation