os_logs住在哪里?可以解析它们吗? [英] Where do os_logs live? Can they be parsed?

查看:98
本文介绍了os_logs住在哪里?可以解析它们吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用aslmsg,可以遍历日志的每个消息来创建NSString,然后对它们执行我们想做的任何事情.我正在使用os_log,但是没有看到可以解析记录的消息的出口...记录只能通过终端查看吗?还是某个对象可以访问这些对象?

With aslmsg, it was possible to iterate through each message of a log to create NSStrings and then do whatever we wanted with them. I'm moving to use os_log, but don't see an outlet where I can parse through the logged messages...are the logs only visible through the terminal or is there some object living somewhere where I can access these?

推荐答案

有一个 统一日志记录和活动跟踪" 在WWDC 2016上的会议.

There was a "Unified Logging and Activity Tracing" session at WWDC 2016. From the transcript:

在这个新系统中,日志记录数据以压缩二进制格式保存在磁盘上,称为.tracev3文件.

In this new system logging data is kept in a compressed binary format on disk, it's called a .tracev3 file.

这些文件现在与/var/db/uuidtext中的其他支持文件一起存储在/var/db/diagnostics下.有一些新工具可以访问该数据,有一个新的控制台,有一个新的日志命令行工具,您需要牢记的一件事是因为数据现在以二进制格式存储,因此必须使用新工具来访问数据.它.因此,您不再需要通过日志进行grep浏览,而必须使用我们的工具来浏览日志.

Those files are now stored under /var/db/diagnostics with additional supporting files in /var/db/uuidtext. There are new tools to access that data, there's a new Console, a new log command line tool and one of the things you have to keep in mind is because the data is now stored in a binary format you must use the new tools to access it. So you can no longer grep through logs you have to use our tools to do the surfing through it.

因此可以访问文件,但不适合解析.读 仅通过/usr/bin/log工具支持日志消息 和控制台.

So the files are accessible, but not suitable for parsing. Reading the log messages is only supported via the /usr/bin/log tool and the Console.

这篇关于os_logs住在哪里?可以解析它们吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆