x First time here? Check out the FAQ
  • Avatar22posts46karma

    Umbraco 5 Log

    Andrew Hawken started this topic 4 months ago , this topic was edited at: Friday, January 13, 2012 5:44 PM

    There is no UmbracoLog table in v5. When errors say for more info see the Umbraco log, where do I look?


  • Replies

  • Avatar1725posts3733karma
    Comment with ID: 103207
    Richard Soeteman posted this reply 4 months ago

    Hi Andrew,

    V5 is using log4net(http://logging.apache.org/log4net/ ) Logs are stored in App_Data\Logs

    Hope this helps,

    Richard

     


  • Avatar234posts268karma
    Comment with ID: 103243
    Pinal Bhatt posted this reply 4 months ago

    yes logs are stored in text files under App_Data\Logs.

    But one more question : If i want to write logs thru my partial views, how to do that? In other words how to write our own logs into the same log files?


  • Avatar51posts109karma
    Comment with ID: 103248
    Richard Boelen posted this reply 4 months ago

    Hi,

    reference Umbraco.Framework.Diagnostics and use LogHelper

    @using Umbraco.Framework.Diagnostics
    @{
     LogHelper.Warn<string>("Hello logger");
    }

    Cheers


  • Avatar51posts109karma
    Comment with ID: 103253
    Richard Boelen posted this reply 4 months ago

    Or

    LogHelper.TraceIfEnabled<string>(() => { return "Hello logger";});


  • Alex Norcliffe posted this reply 4 months ago

    Hi there, all great answers. One other tip is that because we just use standard log4net, if you'd prefer to log to a database, or change which items get logged, you can do so by editing the App_Data/Umbraco/Config/log4net.config file


  • Avatar234posts268karma
    Comment with ID: 103259
    Pinal Bhatt posted this reply 4 months ago

    Wow... Thanks Richard & Alex

    One more que: How to enable tracing in U5 just we use to do in U4.x using umbDebugShowTrace=true?


  • Avatar51posts109karma
    Comment with ID: 103260
    Richard Boelen posted this reply 4 months ago

    At the moment its on by default. In log4net.config you can change the log levels that get output. Info has been set for root, so traceing is on I guess

    Cheers


  • Avatar234posts268karma
    Comment with ID: 103261
    Pinal Bhatt posted this reply 4 months ago

    i think i kept my question in workng way.

    Does U5 supports the functionality (umbDebugShowTrace=true) that we have in U4.x.With this entry in query string and one more web.config chage we can see on screen information about macros used on the page. http://our.umbraco.org/wiki/how-tos


  • Tom van Enckevort posted this reply 4 months ago

    Something that I find useful as well is to use your current class type, like this:

    LogHelper.Warn<MyClassName>("Hello logger");
    
    LogHelper.TraceIfEnabled<MyClassName>(() => { return "Hello logger"; });

    That way your log messages will appear with the class name next to it, which can be helpful when trying to track down errors in your code.


Please login or Sign up To post replies