Copied to clipboard

Flag this post as spam?

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


  • Phil Veloso 38 posts 251 karma points
    Jul 22, 2019 @ 18:33
    Phil Veloso
    0

    customErrors trigger email notification

    Hello,

    I would like to send an email notification when a custom error occurs on my production site, does anyone have any suggestions or can point me in the right direction on how to implement this?

    I'm currently using services like pingdom but they do not cover all node urls and as yet do not have a automated testing system robust enough to catch everything.

    Many thanks, Phil

  • Phil Veloso 38 posts 251 karma points
    Jul 22, 2019 @ 21:30
    Phil Veloso
    101

    I have been able to achieve this my extending log4net, which Umbraco using as its logging framework.

    Add the following to your log4net configuration file:

    <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
        <to value="TO EMAIL ADDRESS" />
        <from value=”FROM EMAIL ADDRESS" />
        <subject value="Test Logging Message" />
        <smtpHost value="localhost" />
        <bufferSize value="512" />
        <lossy value="true" />
        <evaluator type="log4net.Core.LevelEvaluator">
            <threshold value="ERROR"/>
        </evaluator>
        <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline%newline%newline" />
    </layout>
    

    Then add the following appender-ref element to the root section of the log4net config file:

    <appender-ref ref="SmtpAppender" />
    

    Hope this helps anyone who is interested!

Please Sign in or register to post replies

Write your reply to:

Draft