Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by ewoutee · Mar 27, 2017 at 04:06 PM · loglogging

Don't overwrite output_log.txt between runs

I'm looking for a way to keep the information in the output_log.txt file between runs of the application. As far as I can tell, Unity clears the file every time the application is started. This is what I'm trying to prevent.

Right now I have a coroutine that copies the output_log.txt file to a folder every couple of seconds. The issue with this solution is that if a crash happens, the most important lines in outpot_log.txt from just before the application crashed probably won't be copied. So I'm looking for a solution or an improvement to the solution I already have.

Any help would be appreciated!

Comment
Add comment · Show 9
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 Hellium · Mar 27, 2017 at 04:07 PM 0
Share

Why do you copy the file every couple of seconds ins$$anonymous$$d of at start ?

avatar image ewoutee Hellium · Mar 27, 2017 at 04:09 PM 0
Share

@Hellium that's what I'm doing, I have a coroutine that copies the file every couple of seconds, not just at the start

avatar image Hellium ewoutee · Mar 27, 2017 at 06:53 PM 0
Share

$$anonymous$$y question is "why" you do this ? Copying the file when the game starts should be enough.

Show more comments
avatar image Hellium · Mar 27, 2017 at 09:39 PM 0
Share

$$anonymous$$aybe you can use OnApplicationQuit ?

avatar image Joe-Censored Hellium · Mar 27, 2017 at 10:01 PM 1
Share

He's trying to catch crashes. It wouldn't really be a crash if it was calling OnApplicationQuit.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by sarahnorthway · Jul 12, 2017 at 08:16 PM

In the advent of a crash, Unity makes a copy of output_log.txt, along with crash.dmp and error.log, and stores them in a subdirectory of GAMENAME_Data named the datetime of the crash.

I also often want play data from previous sessions that don't cause crashes. I considered using a Debug.Log wrapper that keeps its own independent log file, but it can't catch all internal Unity or DLL exceptions. Your method of duplicating output_log.txt regularly may be the best bet. Make sure you call it one last time during OnApplicationQuit, which should always run when the app quits correctly.

Comment
Add comment · Show 1 · 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 Bunny83 · Jul 12, 2017 at 08:25 PM 2
Share

Unity has a log-event to which you can subscribe. It should be called for any log including internal errors. Application.log$$anonymous$$essageReceived The callback receives the actual message, a stacktrace as string as well as the log type

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

8 People are following this question.

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

Related Questions

Logging frameworks/libraries in C# 3 Answers

How to get rid of "Development Build" watermark but still have stacktrace in output log 0 Answers

How do I find the player log file from code? 2 Answers

Script Reference Problem... 1 Answer

Useless lines in output_log.txt 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