Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
3
Question by DannyB · Feb 09, 2013 at 10:28 AM · iosdebugstacktrace

Enable stack trace in non development builds

Hello everybody,

I have created my custom log handler, using RegisterLogCallback(). My intention is to be able to catch all errors, and send them to my server for logging.

Everything works perfectly as expected, with the exception of one thing:

The Stack Trace is empty when I create a build without the Development Build checkbox checked.

Now here is the weird part:

  • Development Build checked, building on iOS device - The result is ok (stack trace contains data).

  • Development Build unchecked, building on iOS simulator - The result is ok (stack trace contains data).

  • Development Build unchecked, building on iOS device - the result is NOT OK (stack trace is empty).

I would like to enable stack trace on my production build as well, so I can better understand what errors occur in production builds.

Can this be done? I mean, it does work in the simulator, so what reason is there for it not working on the device?

Thanks in advance.

Comment
Add comment · Show 3
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 DannyB · Feb 21, 2013 at 02:06 PM 0
Share

Update:

  1. Unity support asked me to open a bug report

  2. I opened it (case 523472)

  3. Unity QA said its not a bug, but "by design"

I sure wish this "by design" feature would let the developer choose if he wants traces to be sent or not on development builds.

avatar image Bunny83 · Feb 21, 2013 at 02:17 PM 0
Share

Uhm sure, just check the development build checkbox... That's what it's good for.

I don't quite get your question. You turn off the development build and wonder why development tools don't work?

avatar image DannyB · Feb 21, 2013 at 02:42 PM 0
Share

Are you serious with this comment?....

Don't you understand the value of getting trace from PRODUCTION builds?

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by yoyo · Aug 13, 2013 at 10:32 PM

Try getting the stack trace yourself, rather than relying on Unity to do it, something like this (C# example):

 private void Awake()
 {
     Application.RegisterLogCallback(LogHandler);
 }
 
 private void LogHandler(string message, string stacktrace, LogType type)
 {
     System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace();
     // Now use trace.ToString(), or extract the information you want.
 }

For more information on the StackTrace class, see Microsoft's documentation on MSDN.

Comment
Add comment · Show 6 · 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 DannyB · Aug 13, 2013 at 10:36 PM 0
Share

Thanks for this. Good to see that old questions still have hope.

Tested and working nicely. Big improvement for me in catching production errors.

avatar image yoyo · Aug 14, 2013 at 04:48 PM 1
Share

Cool, glad it worked. Note that the System StackTrace class may not include file and line number information in a non-development build.

avatar image DannyB · Aug 14, 2013 at 04:51 PM 0
Share

Yes, I noticed. Well, in fact in both development and non development I do not get the line number, but I do get file and method. Good enough for me. $$anonymous$$uch better than before in any case.

avatar image StephanK · Mar 19, 2014 at 11:24 AM 0
Share

I tried that, but I'm only getting Application.CallLogCallback and my own LogHandler method in the stacktrace. Am I missing something?

avatar image DannyB · Mar 19, 2014 at 11:35 AM 0
Share

You should see the entire trace. I am using this call, and it seems to get me the appropriate trace:

 using System.Diagnostics;
 
 string $$anonymous$$yStackTrace() {
     StackTrace trace = new StackTrace(4, true);
     return trace.ToString();
 }
Show more comments

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.

Follow this Question

Answers Answers and Comments

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to use Webgl Debug Symbols? 0 Answers

Less verbose Debug.Log ( Xcode ) 0 Answers

Can't find unity-remote-4 in AppStore 3 Answers

iOS. Jerks in first 15-20 seconds after starting scene 0 Answers

iOS Photon Cloud disconnect on old devices 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges