Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ayo Adesina 445 posts 1059 karma points
    Jul 06, 2015 @ 09:42
    Ayo Adesina
    0

    How to log directly to UmbracoTraceLog.txt

    Hi guys,

    I'm slightly confused about how error logging works in umbraco, I am assuming there is not a huge difference between V6 and V7?

    If I have a problem on an umbraco website the first place I usually look is UmbracoTraceLog.txt, 9 out of 10 times I will usally find out what the problem is.

    The other place to look is in the umbracoLog db table.

    I have got some complex code running in a gathering node data event, if I get an exception, I want to log this.

    My first instinct is to store this in the UmbracoTraceLog.txt file , its easy to get to, open in txt editor, etc etc.

    After a bit of googling, I still don't quite understand when something is logged to the db and when something is logged to the UmbracoTraceLog.txt file.

    For my scenario I just want to log to UmbracoTraceLog.txt and not the db, can someone please explain how I can do this.

    Thanks Ayo

  • jigar 170 posts 233 karma points
    Jul 06, 2015 @ 11:34
    jigar
    2

    Hi Ayo,

    In your view you can put

    @using Umbraco.Core.Logging; 
    @{
            LogHelper.Info(this.GetType(), "My Custom Message);  
     }
    

    And that will be logged in UmbracoTraceLog.txt.

    Hope it helps

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies