Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8749191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:39:11+00:00 2026-06-13T12:39:11+00:00

I’m trying to get Log4Net working with web email, either Yahoo or Gmail. If

  • 0

I’m trying to get Log4Net working with web email, either Yahoo or Gmail. If you have this working, I would appreciate some help, and thanks in advance.

I’ve got a default root logger, with a RollingFileAppender and an SmtpAppender.
The file appender is working fine. The SmtpAppender is giving me nothing.

I am calling the logger from a diagnostic button click…

protected void btnReloadContractConfig_Click(object sender, EventArgs e)
{
    // DIAGNOSTIC - Test email logger
    log4net.ILog logger = log4net.LogManager.GetLogger("root");
    logger.Error("btnReloadContractConfig_Click() - This is a TEST of delivery of error messages via email, triggered from the Admin.aspx.cs code file.");
}

…and the RollingFileAppender is getting the message…

LOC=20120921-12:03:16.319,UTC=20120921-11:03:16.319,DELTA=10078,THR=6,ERROR,LOG=root,[(null)] – btnReloadContractConfig_Click() – This is a TEST of delivery of error messages via email, triggered from the Admin.aspx.cs code file.

The web.config entries for Log4Net are here::

  <appSettings>
    <add key="log4net.Internal.Debug" value="true"/>        
  <appSettings>


  <log4net 
    xsi:noNamespaceSchemaLocation="http://csharptest.net/downloads/schema/log4net.xsd" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <root>
      <level value="DEBUG" />
      <appender-ref ref="LogFileAppender" />
      <appender-ref ref="SmtpAppender" />
    </root>

    <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
      <file value="MiniMkt01Log.txt"/>
      <!-- <file value="${TMP}\log-file.txt" /> -->
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="10" />
      <maximumFileSize value="10MB" />
      <staticLogFileName value="true" />
      <layout type="log4net.Layout.PatternLayout" >
    <header value="[Header]&#13;&#10;" />
    <conversionPattern value="LOC=%date{yyyyMMdd-HH:mm:ss.fff},UTC=%utcdate{yyyyMMdd-HH:mm:ss.fff},DELTA=%timestamp,THR=%thread,%-5level,LOG=%logger,[%property{NDC}] - %message%newline" />
      </layout>  
    </appender>

    <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
      <to value="FacelessDevTeam@yahoo.com" />
      <from value="hiblet@yahoo.com" />
      <subject value="Logging Message" />
      <smtpHost value="smtp.yahoo.com" />
      <port value="25"/>
      <authentication value="Basic" />
      <username value="FacelessDevTeam@yahoo.com"/>
      <password value="?????[real password hidden for obvious reasons]"/>
      <!-- <EnableSsl value="true" /> -->
      <bufferSize value="10" />
      <lossy value="true" />
      <evaluator type="log4net.Core.LevelEvaluator">
    <threshold value="WARN"/>
      </evaluator>
      <layout type="log4net.Layout.PatternLayout">
    <header value="[Header]&#13;&#10;" />
    <!-- Previously... <conversionPattern value="%newline%date,%utcdate,%timestamp,[%thread],%-5level,%logger,[%property{NDC}] - %message%newline%newline%newline" /> -->
    <conversionPattern value="%newlineLOC=%date{yyyyMMdd-HH:mm:ss.fff},UTC=%utcdate{yyyyMMdd-HH:mm:ss.fff},DELTA=%timestamp,THR=%thread,%-5level,LOG=%logger,[%property{NDC}] - %message%newline%newline%newline" />
      </layout>
    </appender>

  </log4net>

The web.config is being picked up in the Global.asax file, in the Application_Start() handler…

void Application_Start(object sender, EventArgs e) 
{
    // Start Log4Net, signal app has started
    log4net.Config.XmlConfigurator.Configure();
    log4net.ILog logger = log4net.LogManager.GetLogger("root");
    logger.Info("Application_Start()");
}

The admin web page that triggers the email attempt seems to either hang indefinitely, or hang momentarily (half second) and continue.
The dev environment does not collapse with an exception, it’s either hang or glide on without error.

  • How do I get additional diagnostics out of the SmtpAppender?
  • Can I independently test the port/config to check for a local block on outgoing programmatic email?
  • Is a log4net email guaranteed to be sent? The lossy and bufferSize properties
    seem very sensitive, if I put lossy=false, I get an indefinite hang…

For reference I am using VS 2010, ASP.Net4, and lots of caffeine. Thanks again for any forthcoming help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:39:12+00:00Added an answer on June 13, 2026 at 12:39 pm

    OK, figured it out and am now receiving emails. I couldn’t find many solutions on the Internets, so here’s what I had to do.

    I first set up a tiny console email program to validate that I could do basic email sending from my machine. This requires you to add a section to your web.config (or app.config in this case) that configures the SMTP client.

    When I got that working, and I could send emails from the stand-alone app, I copied the required section into my main project’s web.config file, and, hot-diggity-dog, it worked. Here, just out of pure love for my fellow humans, is the system.net section that worked for me with Gmail…

    <configuration>
    
    [... your config stuff]
    
      <system.net>
        <mailSettings>
          <smtp deliveryMethod="Network" from="chunkyLover69@gmail.com">
            <network
              host="smtp.gmail.com"
              enableSsl="true"
              port="587"
              userName="chunkyLover69@gmail.com"
              password="yesThisIsMyRealPasswordIAmAnIdiot"
              defaultCredentials="false"/>
          </smtp>
        </mailSettings>
      </system.net>
    
    [... some more of your config stuff]
    
    </configuration>
    

    So that was the key, I had no system.net section in my .config file, hence epic fail. Hope this helps someone else out in future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.