+1-888-365-2779
Try Now
More in this section

Forums / Set-up & Installation / Error Logging Emails

Error Logging Emails

3 posts, 1 answered
  1. Gavin
    Gavin avatar
    20 posts
    Registered:
    06 Jul 2009
    15 Oct 2009
    Link to this post
    Hi,

    Does Sitefinity have any functionality where error reports can be sent out to the administrator?

    I've used ELMAH in the past to provide this functionality.

    Cheers,
    Gavin
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    15 Oct 2009
    Link to this post
    Hi Gavin,

    You can send each information that has been logged in Sitefinity.log file. You need to create a custom monitoring provider.

    1. Create a new class that inherits from TextFileWebEventProvider
    2. Override process request.

    namespace HealthMonitoringCustom
    {
        public class Class1 : TextFileWebEventProvider
        {
     
            public override void ProcessEvent(System.Web.Management.WebBaseEvent raisedEvent)
            {
                base.ProcessEvent(raisedEvent);
                string to = "YOUR EMAIL HERE";
                string from = "YOUR DATA HERE";
                string Subject = "A new error occured";
                string body = raisedEvent.Message.ToString() + raisedEvent.ToString();
                SmtpMail.SmtpServer = "YOUR SERVER HERE";
                SmtpMail.Send(from, to, Subject, body);
            }
        }
    }

    3. Compile the code into dll and add it to your bin folder.

    3. Modify healthMonitoring section as shown below:

    <healthMonitoring enabled="true" heartbeatInterval="0">
                <eventMappings>
                    <add name="Simple Web Request Event" type="Telerik.Utilities.SimpleWebRequestEvent,Telerik.Framework"/>
                    <add name="Code Benchmark Event" type="Telerik.Utilities.CodeBenchmarkEvent,Telerik.Framework"/>
                </eventMappings>
                <providers>
            <add name="MyProvider" type="HealthMonitoringCustom.Class1, HealthMonitoringCustom" logFileName="~/App_Data/sitefinity.log"/>
                    <add name="Simple Web Buffered Event Provider" type="Telerik.Utilities.BufferedTextFileWebEventProvider,Telerik.Framework" bufferMode="Notification" logFileName="~/App_Data/sitefinity.log"/>
                    <add name="Code Benchmark Provider" type="Telerik.Utilities.CodeBenchmarkTextFileProvider,Telerik.Framework" enabled="False" logFileName="~/App_Data/performance.log"/>
                </providers>
                <rules>
            <add name="SitefinityErrorHandler" eventName="All Errors" provider="MyProvider" minInterval="00:00:00" minInstances="1" maxLimit="Infinite"/>
                    <add name="SitefinityCodeBenchmarkHandler" eventName="Code Benchmark Event" provider="Code Benchmark Provider" minInterval="00:00:00" minInstances="1" maxLimit="Infinite"/>
                </rules>
            </healthMonitoring>

    Another option is adding ELMAH to Sitefinity. As I see "It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment". I hope this helps.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
  3. Gavin
    Gavin avatar
    20 posts
    Registered:
    06 Jul 2009
    18 Oct 2009
    Link to this post
    Hi Ivan,

    Thanks for that - both techniques work well, but I've gone with the ELMAH version as it reports on more of the errors e.g. page not founds etc.

    Cheers,
    Gavin
Register for webinar
3 posts, 1 answered