Copied to clipboard

Flag this post as spam?

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


  • Saied 349 posts 674 karma points
    Sep 29, 2015 @ 15:55
    Saied
    0

    Logging simple messages in Umbraco?

    I would like to log a simple message to Umbraco, I don't care what type it is associated with.

    I tried using UmbracoLogService but I have no idea what table that writes to.

    I just want to log something like "Hello" to a database

  • Nicholas Westby 2005 posts 6843 karma points c-trib
    Sep 29, 2015 @ 16:14
    Nicholas Westby
    1

    What version of Umbraco are you using? I typically just use LogHelper, though I remember reading they plan to create a service, as LogHelper is a static class, and so makes unit testing harder.

    LogHelper (and maybe UmbracoLogService) logs entries to UmbracoTraceLog.txt (in App_Data\Logs).

    Note that Umbraco uses Log4Net under the hood. If you want, you can create your own log appender (see https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Core/Logging/AsynchronousRollingFileAppender.cs for Umbraco's implementation) and configure it in log4net.config (in the Config folder). Your custom one could store logs to the database.

  • 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