简体   繁体   English

从控制台应用程序查看信息和调试日志

[英]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.

相关问题 Xcode调试控制台,带有默认日志颜色 - Xcode debug console with colors for default logs React Native:当我从 XCode 运行应用程序时看不到 console.logs - React Native: Can't see console.logs when I run application from XCode 我如何调试线程1:signabrt,调试控制台不显示任何日志 - How do I debug a Thread 1: signabrt, debug console doesn't show any logs 如何从Xcode中删除MPAVController控制台日志 - How to remove MPAVController console logs from Xcode 无法在Xcode中调试:来自此模块的调试信息在调试器中不可用 - Cannot debug in Xcode: Debug info from this module will be unavailable in the debugger 在调试视图层次结构中查看 CALayers - Viewing CALayers in Debug View Hierarchy Unity3D/Xcode:调试日志在设备上不可用,在控制台中看不到 - Unity3D/Xcode: Debug Logs not available on Device, can't see in Console 当AutoLayout在调试控制台中记录无法满足的约束时,如何使AutoLayout崩溃? - How can I make AutoLayout crash my app when it logs unsatisfiable constraints in debug console? 从iPhone中的设备调试应用程序? - Debug application from the Device in iPhone? 在模拟器中查看应用程序 - Viewing application in simulator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM