简体   繁体   中英

Get Xcode console output to log in a file

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?

There is a wonderful framework that will do this (and other logging methods) for you. It's called CocoaLumberjack

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

Try this instead in mac terminal

check name of the device from About Section

sudo log collect --deviceName "NAME" --last 10m --output iphone_test1.logarchive

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM