Xcode Scheme Post-Actions 的日志文件在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10723174/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:24:05  来源:igfitidea点击:

Where is the logfile located for Xcode Scheme Post-Actions?

xcodeloggingpost-buildxcode-scheme

提问by Locksleyu

I am running a script in my Xcode project in the Scheme's Build->Post-actions "Run Script". It runs fine but I would like to see the console output of that script. It doesn't seem to be included in the Log Navigator tab, where can I find this log?

我正在我的 Xcode 项目中的 Scheme 的 Build->Post-actions“Run Script”中运行一个脚本。它运行良好,但我想查看该脚本的控制台输出。Log Navigator 选项卡中似乎没有包含它,我在哪里可以找到此日志?

回答by digitalvision

The output from those scripts doesn't seem to be logged anywhere by default. Your best bet is to manually redirect the output of the script to a known location. For example, add the following as the first line of your script:

默认情况下,这些脚本的输出似乎没有记录在任何地方。最好的办法是手动将脚本的输出重定向到已知位置。例如,将以下内容添加为脚本的第一行:

exec > /tmp/my_log_file.txt 2>&1

This will redirect all following output to stdout and stderr to your specified log file.

这会将所有后续输出重定向到 stdout 并将 stderr 重定向到您指定的日志文件。