如何获取XCode应用程序的日志 [英] How to get logs for the XCode application

查看:382
本文介绍了如何获取XCode应用程序的日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找Xcode应用程序本身的日志.不是我的iOS应用或设备的日志.

I'm looking for logs of the Xcode application itself. Not logs of my iOS app or device.

我一直在使用情节提要源代码xml做一些实验性工作.有时,我会随机崩溃Xcode或类似无法打开文档Main.storyboard'.无法验证文档内容"之类的消息(这与git冲突无关)

I've been doing a bit of experimental work with the storyboard source code xml. Sometimes I'll get a random crash of Xcode or a message like "The document Main.storyboard' could not be opened. Could not verify document content" (This is not git conflict related)

我想查看日志,以查看它是否提供有关xml的哪些部分导致这些崩溃或错误的线索.

I'd like to look in the logs to see if it gives a clue as to what part of the xml is causing these crashes or errors.

注意:通过在控制台"应用程序中查找,我能够找到一些其他崩溃信息.但是没有错误信息.

Note: I was able to find some additional crash information by looking in the 'console' app. But not error information.

谢谢.

推荐答案

这里有几件事.首先,我不相信Xcode会写任何专用的日志文件(相对于Android Studio,它会将日志放在〜/Library/Logs/AndroidStudio2.2下).话虽如此,有两个地方可以帮助他们:

There are a few things here. First of all, I do not believe Xcode writes any dedicated log files (as opposed to, say, Android Studio, that puts logs under ~/Library/Logs/AndroidStudio2.2). Having said that, there are a couple of places to get them:

1.设备日志

Xcode使用系统日志记录将其消息记录到控制台.如果打开控制台应用程序,请在设备"列表中找到您的macOS设备,然后查看消息.默认情况下,它显示来自所有应用程序的所有消息,但是您可以按PROCESS-Xcode进行过滤(过滤有点不直观,您首先搜索生成ANY | Xcode过滤器的Xcode,然后选择ANY并将其更改为PROCESS ).

Xcode uses system logging to log its messages to the console. If you open the Console app, find your macOS device in the Devices list and look at the messages. By default, it shows all the messages from all the apps, but you can filter our by PROCESS - Xcode (filtering is a bit unintuitive, you first search for Xcode which generates ANY|Xcode filter, than you select ANY and change it to PROCESS).

macOS Sierra上的控制台"应用程序的一个问题是,它仅显示启动控制台应用程序时的日志,而不是更早.您可以使用log命令行来收集以前的日志(例如sudo log collect --last 1d).您可以在此处找到更多信息.

The one problem with the Console app on macOS Sierra is that it only shows logs from when you started the Console app, not earlier. You can use the log command line to collect previous logs (e.g. sudo log collect --last 1d). You can find more information about it here.

或者,您实际上可以从终端启动Xcode(通过在终端窗口中键入/Applications/Xcode-beta.app/Contents/MacOS/Xcode).如果这样做,所有日志将被写入终端控制台.

Alternatively, you can actually start Xcode from the terminal (by typing /Applications/Xcode-beta.app/Contents/MacOS/Xcode in the terminal window). If you do that, all the logs will be written to the terminal console.

2.诊断报告

这些(也可通过控制台应用程序访问)将包含Xcode本身未记录的崩溃(在某些情况下Xcode会以静默方式死掉,但诊断报告可能仍包含错误以及调用堆栈和其他有用信息).请注意,在〜/Library/Logs和/Library/Logs下有两个存储诊断报告的地方-确保同时选中两者.

These (also accessible via the Console app) will contain crashes that Xcode itself doesn't log (there are some cases where Xcode will die silently, but the Diagnostics Reports may still contain the error along with the callstack and other useful info). Note that there are two places where Diagnostic Reports are stored, under ~/Library/Logs and /Library/Logs - make sure to check both.

这篇关于如何获取XCode应用程序的日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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