- Home /
unity commandline execution debugging
If I run something from the commandline, do Debug.Logs get output to a file? If so, where is the file? (I don't see it in with the webplayer log files, for instance).
Answer by duck · May 19, 2010 at 11:01 AM
To debug built versions of your game (whether they're running in Batch Mode or not), you need to continue to use Debug.Log messages in your code, just like you would in the Editor, however you need to find the log file generated by your build. These are separate files to the one that the editor generates when playing your project in the editor.
The location and filename for logs from your built version depends on which platform you're running on (mac/windows), and what kind of build it is (web/standalone). The location does not change if run in Batch Mode.
For webplayer builds, the log files can be found here:
OS X:
/Users/<USERNAME>/Library/Logs/Unity/WebPlayer.log
Windows XP:
C:\Documents and Settings\<USERNAME>\Local Settings\temp\UnityWebPlayer\log
Vista/Windows 7
C:\Users\<USERNAME>\AppData\Local\Temp\Low\UnityWebPlayer\log
For Windows EXE builds, the log file is located in the 'Data' folder that accompanies your build, and is named "output_log.txt".
For Mac stand-alone builds, it seems all builds write to the same location mentioned above (/Users/<USERNAME>/Library/Logs/Unity
), but under the filename "Player.log" instead of "WebPlayer.log".
It's useful to open these log files with a program which detects incremental changes to the file and either informs you that the file has changed (such as Notepad++ for windows), or even better, "tails" the file to show the newly added lines (tail for Mac, and BareTail for Win both do this) so that you get a scrolling pane of text showing changes to the log file as they happen.
Answer by qJake · May 05, 2010 at 12:25 AM
Note: this post is incorrect. Please disregard it.
Any Debug calls are removed during compile-time. Debug statements are only for use in Unity Editor while creating your game.
.NET has various file operation classes. You could very easily write your own debug class that could output to a file, and use that instead. Writing your own would work no matter what, even if you compiled and ran your game outside of Unity.
I thought so too, but Debug.Log output is not removed from the release build automatically. The output will got into the player-log.
Not true. Debug calls remain in your build, and are written to a log file even in standalone builds and webplayer builds.
Hm... strange. Typically debug statements are removed during compile-time (in general program$$anonymous$$g terms), and you would write your own Logging class if you wanted log output.
Your answer
Follow this Question
Related Questions
Have my debug log saved to a .log file in build. 2 Answers
Debug.Log Override? 3 Answers
Reading the profiler log 0 Answers
Debug.Log is causing an Assert 2 Answers