- Home /
Redirecting Build Output to Console for Automated Builds
I am trying to run automated Unity (Version 4.5.5f1) builds through a Jenkins server. So far, I've been able to specify the log output location of the build using the following command:
Unity.exe -batchmode -quit -logFile %WORKSPACE%\Build\Build.log ...
This puts the log file into the build directory. However, I want to have the Unity build log show up as part of the Jenkins build log for easier troubleshooting. The Jenkins build log is created from the console output of the task.
How can I do this?
You can deploy the log file as a build artifact, which gives you some visibility via Jenkins. You can also write a file monitoring process to read the log file as it's written and echo it to standard output. (I had this working, but am now running into issues with Unity.exe hanging when run from Jenkins. Though this is happening with or without my file monitor.)
Answer by kork · Feb 09, 2016 at 07:35 PM
Simply add the parameter -logfile
to the console command (without appending an actual log file name). This will make Unity print all log output to stdout. This article explains it: https://effectiveunity.com/articles/how-to-create-your-own-unity-cloud-build-part-3.html (it's actually about TeamCity but the same principles apply for Jenkins as well).
Cool. This also works for applications built with Unity3D. Worked on my server app (Linux headless mode). Using Ubuntu 14.04 and Unity 5.6: ./myapp.x86_x4 -logfile
Answer by QualityJohn_TT · Feb 22, 2021 at 05:13 PM
In more recent versions of Unity (2020.2+) use the logfile command with a hyphen as the output location -logfile -
to capture the build logs in Jenkins
As of Nov 2021 this is still the only answer that works with Unity 2020.3+
Answer by thehemi · Feb 23, 2018 at 10:33 PM
Is this still working for people? I have "-logfile" (no file name) but get no output to the console... Thanks!
Looks like this will work as stated on OSX, but not on windows. Currently on Unity 2017.3. The lack of documentation on the unsupplied file path feels like a bug or just happenstance rather than actual functionality.
Answer by jrodenburg_ncsoft · Jun 28, 2018 at 10:47 PM
Reproduced this issue with -logfile and no parameters on 2017.4.6. Seems fixed in 2018.1 https://issuetracker.unity3d.com/issues/command-line-logfile-with-no-parameters-outputs-to-screen-on-os-x-but-not-on-windows
This was the workaround used: -logfile 2>&1 > ${projectDir}/Editor.log
https://issuetracker.unity3d.com/issues/command-line-logfile-with-no-parameters-outputs-to-screen-on-os-x-but-not-on-windows Seems not fixed. By the way, one more idea (not tested, should work in theory) for workaround: Unity uses Debug.Log() when outputting logs, including logs during build. Set Application.log$$anonymous$$essageReceived and redirect logs where you want
Answer by watsonsong · Oct 11, 2018 at 12:05 PM
Is there any way to output the log when using any CI system like jenkins pipeline?
Your answer
![](https://koobas.hobune.stream/wayback/20220613181322im_/https://answers.unity.com/themes/thub/images/avi.jpg)