获取 Xcode 控制台输出以登录文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12702211/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Get Xcode console output to log in a file
提问by AFraser
I'm running some iOS app tests and would like to get xcode's console to log its output to a file. Is there a way I can do this?
我正在运行一些 iOS 应用程序测试,并希望让 xcode 的控制台将其输出记录到文件中。有没有办法做到这一点?
回答by borrrden
There is a wonderful framework that will do this (and other logging methods) for you. It's called CocoaLumberHyman
有一个很棒的框架可以为您执行此操作(以及其他日志记录方法)。它叫做CocoaLumberHyman
回答by Parag Bafna
Take a look at Redirecting debug output from XCode 4 console to a log file.
defaults write com.apple.Xcode PBXGDBDebuggerLogToFile YES
defaults write com.apple.Xcode PBXGDBDebuggerLogFileName <filepath>
/Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gdb/gdb-arm-apple-darwin
#!/bin/sh
/Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gdb/gdb-arm-apple-darwin- $* | tee -a $HOME/tmp/xcode-gdb.log 2>&1

