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 /
  • Help Room /
avatar image
0
Question by filip-vondrasek · Nov 07, 2016 at 10:58 AM · filelog

Access the log file in script

I'd like to access the log file in my script and send it by email when a user chooses such an option. Is there a possibility to do something like Debug.LogFile which would return a File object or something like that?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Landern · Nov 07, 2016 at 02:00 PM

Kinda, you would need to implement your own version of ILogHandler and ILogger, then finally change the associated logged from the default by setting Debug.logger. If everything goes alright and there isn't anything internal that checks for the project in release mode you can have the logger log however you want(hence the implementation of ILogHandler. The link provided for ILogHandler shows a log to FileStream, this would of course need options set on the platform to output the file(system file access and all that).

If the above doesn't work, you will either need to yoink an asset or design your own, there are plenty of simple logging solutions that exist open source, but just need to search for them through whatever search engine you use.

Comment
Add comment · Show 4 · 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 filip-vondrasek · Nov 07, 2016 at 02:02 PM 0
Share

Well, I can simply take the file from %appdata%, but I thought there might an easier way. I don't really want to overwrite the whole logging system just to be able to easily send the log file over the email.

avatar image filip-vondrasek filip-vondrasek · Nov 07, 2016 at 02:03 PM 0
Share

By easier I meant something dedicated to this simple task. :)

avatar image Landern filip-vondrasek · Nov 07, 2016 at 02:18 PM 0
Share

The current system is setup in such a way that you will need to implement your specific need one way or the other to gain what you want, but wouldn't be all that bad to implement yourself with reasonable conclusions that writing to the system can get expensive. If your game/program crashes then you may not have the information to push though email yet. If the issue is arising from things like reports your game is crashing, Unity has provided a class for that and the ability for you to pick up the information from the crash report(info here: https://docs.unity3d.com/ScriptReference/CrashReport.html). You can deter$$anonymous$$e if the game/program crashed and get the last report and send it.

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

76 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Super noob question on Debug.Log or Log 1 Answer

How to log the GameObject from a Scriptable Object Event 0 Answers

Syntax 501 error, How to upload without error to FTP Server 1 Answer

Unity GerFile doesn't work on build 0 Answers

Can someone explain to me how FileUtil.CopyFileOrDirectory works ? 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