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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:14:04+00:00 2026-05-27T08:14:04+00:00

.Net 4 I am using log4net in a windows service. The service has an

  • 0

.Net 4

I am using log4net in a windows service. The service has an internal timer and is scheduled to runs every 30 minutes. I would like to receive an email with all the logging activity every time the processing is complete. The only examples I found are with the smtp appender, but that sends an email everytime something is logged which is not what I need.

I would think this is a normal use case, but can’t find any relevant examples…

Thanks for any 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-05-27T08:14:05+00:00Added an answer on May 27, 2026 at 8:14 am

    I don’t think this is a standard use of it, as the SMTPAppender is mostly designed to be used to trigger on errors (which should be rare). Here’s the description of the appender:

    Send an e-mail when a specific logging event occurs, typically on errors or fatal errors.

    Looking at the documentation for SMTPAppender, I see that one of the properties is a class which evaluates the input message, and decides whether to trigger the e-mail to be sent.

    You could create a custom class that will send the e-mail when a specific message is sent, specific source, etc.

    I’m not sure if you could set it from the config with a custom class. You could programatically add the appender and set that property.

    You may need to increase the BufferSize property in order to get the history of logs that you want.

    Or you could roll your own appender. I can’t think of how you’d design it that would be much different than the SMTPAppender, though, except possibly making your buffer unlimited (which is a bit dangerous).

    Alternately you could simply log to a rolling log file appender, and have a service/scheduled task start up every thirty minutes, e-mail off the log file, clean up, and die. I’ve done this on a production web app before, using scheduled tasks and batch files, deployed via an MSI we created in WIX, with a custom action to deploy the scheduled task.

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

Sidebar

Related Questions

Using log4net we would like to log all calls to our ASP.NET MVC controller
I would like to log in the Windows Event Viewer using log4net. I created
I'm trying to add logging to my windows web service built with Quartz.net using
I'm wondering if anyone has any experience using log4net in a multi-threaded environment like
I have log4net implemented in a Visual Studio 2010 VB.NET Windows service. It used
I'm having trouble getting Spring.Net to log, using Log4Net. I'm particulary interested in seeing
I am working on .NET Framework 3.5 using C# in Windows XP as administrator
What is the best logging pattern for asp.net mvc 2 using log4net? When should
I am using log4net for logging my asp.net application. However the log file is
We have been using log4net for logging our asp.net web forms application. Our logging

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.