Search Unity

Prolog: Complete logging system and enhanced console for Unity [Released]

Discussion in 'Assets and Asset Store' started by marnsmith, Mar 27, 2014.

  1. marnsmith

    marnsmith

    Joined:
    Feb 7, 2013
    Posts:
    29
    Hi there,

    I'm pleased to announce that Prolog has just been added to the asset store. I use it extensively on projects I'm involved in, and it's been a huge help to us in quickly identifying unexpected behavior and tracking down bugs. I hope you'll find it as useful as I do.

    I'll continue to be actively updating and supporting Prolog going forward. Very happy to answer any questions that come up as well.

    Now available on the asset store!
    $console_wide.png

    Prolog helps you to both debug much more effectively during development, and to gather more complete information from your fellow developers and beta-testers. Instead of “describe what you were doing,” simply say, send me the log!

    While designed to be efficient enough for deployment, you can also selectively disable logging levels or compile them out entirely with a single switch.

    Features Overview
    • Powered by a slightly modified version of log4net, an industry-standard .NET logging framework.
    • Fine-grain logging levels beyond Debug, Info, and Error.
    • Assign different logging levels to different Game Objects. When one starts misbehaving, just select it and turn up the logging level.
    • Automatically get the Timestamp, game time, Game Object, and more information for each log statement.
    • Highly extensible. Easily add your own log4net appender for even more customized logging.
    • Works on iOS: retrieve complete log files from your iPad!
    • Capture Unity Debug output, or redirect log output to Unity Debug with the included appender (not at the same time!)
    • Full source included.
    Prolog also includes a powerful Console to replace or augment the limited Unity Debug Console.
    • Familiar UI for Unity Console users
    • Instant search to filter log messages
    • Filter by selected objects: just click the Game Object(s) and selectively view their output.
    • Sort by column (Log Level, Game Time, Sender, or Message).
    • Includes Unity Console-like features such as Clear, Error Pause, and Filter by level.

    $console_d_selected_objects.png

    $console_search.png

    $inspector.png
     
    Last edited: Mar 28, 2014
  2. Birdlay

    Birdlay

    Joined:
    Jul 28, 2012
    Posts:
    39
    This looks awesome! One thing though, is it faster than the Unity Console? As in can I spam debug messages and not cause a large amount of lag?
    Thanks!
     
  3. marnsmith

    marnsmith

    Joined:
    Feb 7, 2013
    Posts:
    29
    Thanks :)

    I haven't done any serious benchmarking yet, but in general it's way faster than the Unity Console. Some filtering/sorting operations while spamming can still slow things down since it then goes through all active console events for each new message, but I'll work on improving performance there as well in the next update.
     
  4. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Which version of log4net source you are based on? Tested on android?
     
  5. marnsmith

    marnsmith

    Joined:
    Feb 7, 2013
    Posts:
    29
    Based on the latest stable log4net, 1.2.13. Haven't tested on Android, but have on a bunch of other platforms. If you'd be willing to give it a try on Android, PM me your email and I can send you a copy.
     
  6. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Btw, any reason you choose for log4net over NLog?
     
  7. marnsmith

    marnsmith

    Joined:
    Feb 7, 2013
    Posts:
    29
    It's just what I was used to seeing in industry - NLog looks good too. I'm thinking of switching to something like the Common Logging framework so users can pick what works best for them, but I'm open to other suggestions if there's a compelling reason to do something different.
     
  8. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Me too, I also wonder try Common Logging framework
     
  9. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Actually, I also have a modified version of NLog 2.x that work for android and unity editor.
     
  10. Skyriot

    Skyriot

    Joined:
    Sep 3, 2014
    Posts:
    10
    Can you use this logger to send the logs to external log aggregation platforms like Loggly? I use Loggly because I like sending my logs to a cloud-based aggregator because it allows me to see the logs from production versions of my games so that I can see all the bugs users create without having to try and re-create it myself.

    Does your package have this ability? If so, it would make your plugin quite useful to me!
     
  11. marnsmith

    marnsmith

    Joined:
    Feb 7, 2013
    Posts:
    29
    You can pretty much extend or customize the output however you like by writing a custom log4net appender. It looks like Loggly already has some support for this: https://www.loggly.com/docs/net-logs/, although the setup would be slightly different since XML configuration is not used. You can PM me for a trial if you want to give it a shot.
     
  12. Skyriot

    Skyriot

    Joined:
    Sep 3, 2014
    Posts:
    10
    Yes, I want to try this actually, I'll try and see if I can get messages sending to Loggly and collaborate with you on the results!
     
  13. PKrawczynski88

    PKrawczynski88

    Joined:
    Nov 14, 2013
    Posts:
    15
    @marnsmith
    I have a question.

    When you log to file (as shown in example image on asset store page of this plugin) - can you as well output stacktrace when error happens? This image: https://d2ujflorbtfzji.cloudfront.n...806260-2ad4-4327-af48-4e137e89f2bf_scaled.jpg shows very minimalistic messages.
    Reason why I ask this is because I would like to have good solution for future if and when I will need my beta testers (or players) provide me with debug logs when game crashes or just some feature bugs out.


    Other than that this asset looks pretty stellar compared to other in store.
    If it's okay I would also be interested in 3 days trial (I make up my mind very quickly and would gladly pay if it works well but sadly so many assets I've bought didnt work at all or as intended/advertised that I'm extremely vary right now if I cant test it, hope you understand that and wont take it wrong way)
     
  14. marnsmith

    marnsmith

    Joined:
    Feb 7, 2013
    Posts:
    29
    Hey, good question. What you're seeing in that image is the output from a log4net-formatted message pattern. It looks simple, but you can do some pretty powerful things with it- including printing a stack trace, or opening the file in a 3rd party viewer or database.

    By default the stack trace is not logged in Release builds for performance. Also, YMMV with stack traces in release mode, so I would suggest logging enough detail to track down problems when debugging.

    For you or anyone else who wants to try this anyway, you'll need to modify two lines:

    In Appenders/FileAppenderComponent:31, Modify the CONVERSION_PATTERN definition to something that includes a stack trace, e.g.
    Code (csharp):
    1. ... "%stacktrace{5}"
    For more about patterns, see http://logging.apache.org/log4net/release/sdk/log4net.Layout.PatternLayout.html

    Change PrologUtil.cs:127 to
    Code (csharp):
    1. if (IsError(eventData.Level) || UnityEngine.Debug.isDebugBuild)
    Please PM me with your email to request a trial.
     
  15. MicDE

    MicDE

    Joined:
    Dec 15, 2015
    Posts:
    16
    Hi,

    I tried Prolog 1.1. on Unity3d 5.3.4.
    On Startup It creates two errors:
    Assets/Plugins/Prolog/PrologManager.cs(124,25): error CS0104: `Logger' is an ambiguous reference between `UnityEngine.Logger' and `log4net.Repository.Hierarchy.Logger'
    Assets/Plugins/Prolog/PrologManager.cs(130,24): error CS0104: `Logger' is an ambiguous reference between `UnityEngine.Logger' and `log4net.Repository.Hierarchy.Logger'

    I managed to expand all Logger declarations by log4net.Repository.Hierarchy.Logger. So there were no more errors. Then I tried with one c# script and prepared it like said in the README. But in the Prolog Console no logging takes place.Neither in the log file.
    Any hints? Not compatible with 5.3.4?

    Best
    Mic
     
  16. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,124
    Do you have WebGL issues? I can not compile WebGL bbuilds with prolog
     
  17. marnsmith

    marnsmith

    Joined:
    Feb 7, 2013
    Posts:
    29
    Hi Ashkan, you can try deleting the log4net file AssemblyInfo.cs to get it to compile to WebGL. But it does seem to have some issues, so I wouldn't use it there for deployment. I'll look into this some more in future releases. Sorry for the inconvenience.
     
  18. Sprakle

    Sprakle

    Joined:
    Jun 8, 2013
    Posts:
    31
    This looks like a very useful asset for us, but I do have a couple questions about it.

    - Does it support adding additional log severity levels? (Fatal, Exception, Error, Warn, Info, Debug, Trace, etc)

    - Does the UI support stack trace navigation? In some logging assets, you can click on any line in the console's stack trace to be navigated to that line in your editor. Super useful.

    Thanks!
     
  19. marnsmith

    marnsmith

    Joined:
    Feb 7, 2013
    Posts:
    29
    Here's the list of supported levels, which mostly mirror log4net:

    The latest release (1.2) doesn't yet support stack trace navigation other than from the calling function, but it's something I've implemented and am using/testing which should make the next release. Agreed, it's super useful ;)
     
  20. EdgarSantos

    EdgarSantos

    Joined:
    Nov 11, 2013
    Posts:
    27
    Hi,

    I am using the latest version of Prolog with Unity 5.5.2f1 and there seems to be a problem with the Conditional attributes in the Prolog.cs class.

    Apparently, even though the constants at the top of the file are defined (LOG_ALL, LOG_FINE, LOG_DEBUG, LOG_INFO, LOG_WARN, LOG_ERROR) the methods with the conditional attribute (e.g. [Conditional("LOG_INFO")]) are never called.

    A quick fix that we found around this, was to comment these attributes, and everything is working like normal.

    Also, this used to work fine when we used Unity 5.4.1.

    Cheers
     
  21. zepedroHSK

    zepedroHSK

    Joined:
    Aug 22, 2013
    Posts:
    5
    This issue relates to : https://forum.unity3d.com/threads/conditional-attribute-ignores-defines-in-5-5.447160/#post-3037098
     
  22. marnsmith

    marnsmith

    Joined:
    Feb 7, 2013
    Posts:
    29
    Thanks for the report and for sharing your workaround! You can also try adding the conditionals you need to the player settings, if you want to get selective compilation back in the meantime.

    Thanks for sharing that thread also - I'll look into an alternate method for conditional compilation in the next release.
     
  23. RPGia

    RPGia

    Joined:
    Jan 23, 2017
    Posts:
    44
    Hi, any idea on when the new version will be out?
     
  24. bbvrdev

    bbvrdev

    Joined:
    Aug 11, 2009
    Posts:
    221
    Just purchased Prolog, but objects sending logs with the prolog appender don't appear on the console, even in the demo scene. What am I doing wrong?
     
  25. marnsmith

    marnsmith

    Joined:
    Feb 7, 2013
    Posts:
    29
    Hey Sandworm,
    It's likely the constants issue discussed above.

    A quick way to add all the needed constants is to add them to your project in a file called Assets/msc.rsp:
    -define:LOG_ALL,LOG_FINE,LOG_DEBUG,LOG_INFO,LOG_WARN,LOG_ERROR

    You can also set them up in your player settings. For more info, see https://docs.unity3d.com/Manual/PlatformDependentCompilation.html
     
  26. xmedeko

    xmedeko

    Joined:
    Jun 6, 2018
    Posts:
    23
  27. Andreas_StrangeQuest

    Andreas_StrangeQuest

    Joined:
    Mar 12, 2019
    Posts:
    5
    Sounds like this is a nogo for todays Unity version (2019). Any news about any updates?