docs.unity3d.com
    Show / Hide Table of Contents

    Default configuration

    You can customize and configure the Logging package. For example, you can directly call the logger with something like:

    Log.Info("Hello Info");
    

    Under the hood, Unity configures the following things by default:

    • It captures the logs asynchronously except for log entries with Fatal level.
    • It sets the minimum captured level to Debug. Including debug level log entries, everything above (info, warning, error, fatal) is captured as well.
    • The output template is as follows: shell [{Timestamp}] {Level} | {Message}{NewLine}{Stacktrace}
    • It captures the generated log files in the logs/ folder of the project under the filename Output.log.json and Output.log
    • The logs also appear in the Unity Editor console when available (for versions of Unity after 2022.2.0a15)

    To create a more complex configuration, you can create a LoggerConfig object and pipeline different options such as :

    Log.Logger = new Logger(new LoggerConfig()
    .MinimumLevel.Debug()
    .OutputTemplate("{Timestamp} - {Level} - {Message}")
    .WriteTo.File("..absolutPath.../LogName.log", minLevel: LogLevel.Verbose)
    .WriteTo.StdOut(outputTemplate: "{Level} || {Timestamp} || {Message}"));
    

    The LoggerConfig options are detailed in the Custom configuration documentation.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie 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.
    Generated by DocFX on 18 October 2023