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
0
Question by OldHarryMTX · Mar 09, 2020 at 01:43 PM · serverlinuxdebug.logheadless

Show Debug.Log in the console interface with a linux headless build

Hi all I'm developing a project that use a headless build on a linux Google VM that act like a server. Everything works very well, but I would need the server to print the various Debug.Log on the linux console to monitor its operation. I have tried various solutions for this problem, and all of them involve the use of the -logfile command, that should generates a log file in a specific folder where all Debug.Logs are collected.

After several attempts I found two solutions: use -logfile -, which, in theory, should send log messages directly to the console, or -logfile server.log, which generates the log file which in turn can be sent to the console via the tail -f command.

The problem is that in the log file there is no trace of the Debug.Logs launched by the server, but only the normal report generated by unity and by the networking system (Mirror).

Do you know why it happens?

Thank you in advance

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 Yseron · Apr 09, 2020 at 05:26 AM

You can hook yourself to Unity logs through UnityEngine.Application.logMessageReceived and UnityEngine.Application.logMessageReceivedThreaded made especially for that purpose. The idea was that users would intercept unity logs to build their own mechanism for storing/transmitting logs on the network and on disk, or simply display them. That is because once you are hooked to Unity logs events, you then intercept both Unity native logs, and the logs you emitted through Debug.Log(). An exemple of this here: http://wiki.unity3d.com/index.php/2020/DebugConsole.

Chances are that the logs written on disk with the -logfile command line option do not share the same code path than the logs you perform as one would find out exploring the Unity source files exposed by Unity here: https://github.com/Unity-Technologies/UnityCsReference/tree/master/Projects/CSharp with the following files: Runtime\Export\Logging\DebugLogHandler.cs Runtime\Export\Logging\ILogHandler.cs Runtime\Export\Logging\ILogger.cs Runtime\Export\Logging\Logger.cs Runtime\Export\Logging\UnityLogWriter.bindings.cs

Bonus: Unity are people like you and me. We frequently request features / enhancements. They make common mistakes like the rest of us. Exemple: ask them to replace in UnityLogWritter.binding.cs the following

 [ThreadAndSerializationSafe] public static void WriteStringToUnityLog(string s)
 { if (s == null) return; WriteStringToUnityLogImpl(s); }
 

with the following

 [ThreadAndSerializationSafe] public static void WriteStringToUnityLog(string s)
 { if (String.IsNullOrEmpty(s)) return; WriteStringToUnityLogImpl(s); }

They will answer that they include empty strings because of the new line appended for log file text layout and you will have started a discussion, which will prove you they are humans. Serge Billault.

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

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

132 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 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

What does the headless build option do? 3 Answers

Headless Linux build 100% CPU usage 2019 vs 10% 2018 1 Answer

Server crashes accessing the same asset on 2nd instance 0 Answers

Render to 'RenderTexture' in 'Headless Mode' 0 Answers

Linux game server 1 Answer


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