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 3320088
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:54:06+00:00 2026-05-17T22:54:06+00:00

I have just started playing around with Log4Net… I now want to send an

  • 0

I have just started playing around with Log4Net… I now want to send an email with the full log either attached or directly in the mail. The problem with using SmtpAppender is that it requires a bufferSize which will be unknown because it should send the mail whether it’s full of errors or just info.

Update: My config file

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

    <to value="ebb@mail.com" />
    <from value="ebb@mail.com" />
    <subject value="Backup Application - Log" />
    <smtpHost value="mailserver" />
    <authentication value="1" />
    <username value="userName" />
    <password value="mypw" />

    <port value ="25"/>
    <lossy value="true" />
    <bufferSize value="500" />

    <evaluator type="log4net.Core.LevelEvaluator">
        <threshold value="ALL"/>
    </evaluator>

    <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%timestamp [%thread] %-5level %logger – %message%newline" />
    </layout>

</appender>
  • 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-05-17T22:54:06+00:00Added an answer on May 17, 2026 at 10:54 pm

    BufferSize equals to the number of log messages that have to be buffered (ie if you set to 512 the mail will be sent once 512 messages have been collected).

    I believe that setting it to int.MaxValue (which is 2.147.483.647) is a reasonable choice. 2 billions of messages are too much for a system, even long-running.

    If you give me 10 minutes I’ll confirm you (from source code) that if you clean stop your application, all logs collected so far will be sent

    [Update]: confirmed!! Destructor flushes the queue as expected

    [Add] I would remove both lossy and evaluator. Your problem is clear: Evaluator has precedence over buffer 🙂 🙂

    The evaluator is used to flush the queue when a certain condition is met. Your condition equals to true. When this condition is triggered, the email is sent, so this is why the mail is sent at every single log call.

    This is slightly different from sending ONLY info and error messages, which is achieved by log filtering.

    Remove the two attributes and your code will work. Setting int.MaxValue will allow you to store the maximum possible number of messages. It’s unlikely (you’d better win the Superenalotto’s 178mln€ jackpot like some guys did tonight, or being hit by a comet in your head) that an application collects more than 2 billion errors/info in a run.

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

Sidebar

Related Questions

I've just started playing around with box2dweb and have now run into a problem
i have just started playing aorund with asp.net mvc and i want to view
Possible Duplicate: Is JavaScript's Math broken? I have just started playing around with Javascript
I have just started programming in C++ and I was playing around with templates.
I'm new to cmake and have just started playing around with it. My problem
I´ve just started playing around with Java and Hibernate and have gotten an application
I have just started playing with TeamCity and its great. Now I got it
I just started playing around with Unicorn and NGINX set up (any full-blown reference
I have just started playing around with django-pagination , which is included in some
I just started using OrmLite so I am playing around with it. I have

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.