Copied to clipboard

Flag this post as spam?

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


  • Greg Berlin 818 posts 634 karma points
    May 17, 2013 @ 20:53
    Greg Berlin
    0

    log4net email logs

    Does anyone have a working configuration of a log4net smtp appender to send error logs to an email address?  I've setup a separate appender for my namespace and only want to receive those logs, so want to setup an smtp appender for only errors on my namespace.

    Also, i'd love if it could use the smtp details specified in my web.config instead of entering them again in the log4net.config file.

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 17, 2013 @ 12:27
    Ismail Mayat
    0

    Greg,

    Did you get to the bottom of this?  I am looking to do something similar. I added smtp appender and that works. I added filter that has stopped smtp logging completly my config looks like

      <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">

        <to value="xxxx" />

        <from value="xxxxx" />

        <subject value="Info graphic error" />

        <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>

        <filter type="log4net.Filter.LoggerMatchFilter">

          <loggerToMatch value="MyProject.BusinessLogic.Helpers.RazorHelper" />

        </filter>

        <filter type="log4net.Filter.DenyAllFilter" />

      </appender>

    Note the xxxx is me just hiding actual values ;-}

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft