• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Denise · May 04, 2010 at 11:45 PM · debuglogbatchmode

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).

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
3

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
-2

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.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image StephanK · May 05, 2010 at 11:22 AM 0
Share

I thought so too, but Debug.Log output is not removed from the release build automatically. The output will got into the player-log.

avatar image duck ♦♦ · May 19, 2010 at 09:42 AM 0
Share

Not true. Debug calls remain in your build, and are written to a log file even in standalone builds and webplayer builds.

avatar image qJake · May 19, 2010 at 09:50 PM 0
Share

Hm... strange. Typically debug statements are removed during compile-time (in general programming terms), and you would write your own Logging class if you wanted log output.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

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

Debug.Log print order, or Awake vs Start issue? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges