[英]Viewing info and debug logs from the Console application
I have a Swift 3 Cocoa application that uses Apple's Unified Logging, like this: 我有一个使用Apple统一日志记录的Swift 3 Cocoa应用程序,如下所示:
import os
class MyClass
{
@available(OSX 10.12, *)
static let scribe = OSLog(subsystem: "com.mycompany.myapp", category: "myapp")
func SomeFunction(){
if #available(OSX 10.12, *){
os_log("Test Error Message", log: MyClass.scribe, type: .error)
}
if #available(OSX 10.12, *){
os_log("Test Info Message", log: MyClass.scribe, type: .info)
}
if #available(OSX 10.12, *){
os_log("Test Debug Message", log: MyClass.scribe, type: .debug)
}
}
}
Within the Console application, both Include Info Messages
and Include Debug Messages
are turned on. 在控制台应用程序中,“
Include Info Messages
和“ Include Debug Messages
均已打开。
When os_log
is called, only the error
type message is visible in the Console application. 调用
os_log
,在控制台应用程序中仅可见error
类型消息。 Using terminal, with this command, all message types are visible in the Terminal output: 使用终端,通过此命令,所有消息类型在终端输出中可见:
`sudo log stream --level debug`
I've tried running the Console app as root, via sudo from the command line and the same issue occurs; 我尝试从命令行通过sudo以root身份运行控制台应用程序,并且发生相同的问题; no debug or info messages can be seen, even though they're set to being turned on under the Action menu.
即使已在“操作”菜单下将其设置为打开,也看不到调试或信息消息。
Setting system-wide logging to be debug, has no effect on the Console application output: 将系统范围的日志记录设置为调试,对控制台应用程序输出无效:
sudo log config --mode level:debug
What am I missing and how can I view debug and info messages in the Console application? 我缺少什么,如何在控制台应用程序中查看调试和信息消息?
Apple responded on their Developer forums and confirmed that they have repeated this issue on 10.12.5, so it is is a bug in the OS. 苹果在其开发人员论坛上做出了回应,并确认他们已在10.12.5上重复了此问题,因此这是操作系统中的错误。
A bug report was filled for the upcoming 10.13 Developer Preview and has been fixed in 10.13 version3 (17A306f) 已为即将发布的10.13 Developer Preview填充了一个错误报告,并已在10.13 version3(17A306f)中修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.