Umbraco CMS (.NET): Error Logging xslt Errors / User Controls

I was wondering if there is a way in Umbraco to log errors that we get when xslt or user controls cannot be loaded. As a rule, he shows a red box that says that it cannot load the control and so on. Is there a way to register this correctly?

Thanks in advance.

+5
source share
1 answer

Firstly, it is not supported. If errors occur, it displays html and writes to the asp.net trace log.

. Umbraco Elmah log4net . .

using System;
using System.Linq;
using System.Web;

public class MacroLogging : IHttpModule {

    public void Init(HttpApplication context) {
        context.LogRequest += ContextLogRequest;
    }

    static void ContextLogRequest(object source, EventArgs e) {
        var app = (HttpApplication)source;
        var context = app.Context;
        context.Trace.TraceFinished += TraceFinished;
    }

    static void TraceFinished(object sender, TraceContextEventArgs e) {
        var records = e.TraceRecords.Cast<TraceContextRecord>();
        var categoryTypes = new[] {"Macro", "macro", "umbracoMacro"};
        var traceOutput = records.Where(p => categoryTypes.Contains(p.Category) && p.IsWarning)));
        foreach (var entry in traceOutput) {
            //Your Output entry.Message
        }
    }

    public void Dispose() {}

}

web.config. 1am:), .

+4

All Articles