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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:41:43+00:00 2026-05-22T00:41:43+00:00

I have a BufferingForwardingAppender configured to forward the last 10 messages to a RollingFileAppender

  • 0

I have a BufferingForwardingAppender configured to forward the last 10 messages to a RollingFileAppender when an ERROR occurs. Can I get a custom message to appear in the log before each batch of messages?

I want to indicate that this is a new ERROR event and its context, so that the log is readable?

My log4net configuration is kinda like this:

<appender name="ErrorBufferingAppender" type="log4net.Appender.BufferingForwardingAppender">
  <bufferSize value="10" />
  <lossy value="true" />
  <evaluator type="log4net.Core.LevelEvaluator">
    <threshold value="ERROR" />
  </evaluator>
  <appender-ref ref="ErrorFileAppender" />
</appender>

<appender name="ErrorFileAppender" type="log4net.Appender.RollingFileAppender">
  <param name="File" value="logs\Errors.txt"/>
  <!-- other important parameters -->
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date [%-4thread] %-5level %logger{1} - %message%newline"/>
  </layout>
</appender>

And my desired output is kinda like this

---------- ERROR ----------
2011-05-09 16:59:12,327 [8   ] INFO  AppLogger - DiskStorageMonitor.StartMonitoring()
2011-05-09 16:59:12,331 [8   ] INFO  AppLogger - DiskStorageMonitor.Initializing File System Watcher...
2011-05-09 16:59:12,341 [8   ] INFO  AppLogger - DiskStorageMonitor - LocalSlideDataStorageDrive: C:
2011-05-09 16:59:12,370 [8   ] INFO  AppLogger - Transition: From 'MinimumDiskSpaceQuotaState' to 'IdleState'.
2011-05-09 16:59:26,697 [8   ] INFO  AppLogger - Transition: From 'IdleState' to 'SlideHolderMacroState'.
2011-05-09 16:59:26,702 [8   ] INFO  AppLogger - Transition: From 'SlideHolderMacroState' to 'WaitingForMacroCmdResponseState'.
2011-05-09 16:59:26,781 [12  ] INFO  YStageManager - Moving to: -1.25
2011-05-09 16:59:26,782 [14  ] INFO  XStageManager - Moving to: -142
2011-05-09 16:59:30,800 [12  ] ERROR RecoveringErrorHandler - An error occurred. Retrying... (snipped exception message & stacktrace)

---------- ERROR ----------
2011-05-09 16:59:30,808 [12  ] WARN  MacroCameraRecoverySteps - An error occurred while calling the macro camera. Resetting and retrying...
2011-05-09 16:59:30,809 [12  ] INFO  MacroCameraManager - Resetting the Macro Camera.
2011-05-09 16:59:30,886 [12  ] ERROR GetMacroImageCommandHandler - Macro image processing failed for the slide in position 0. (snipped exception message & stacktrace)
  • 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-22T00:41:44+00:00Added an answer on May 22, 2026 at 12:41 am

    I’ve got a solution that will probably work for you but it is a bit of a work-around. Basically, set two appenders to write to the same file. When you write an error (which will trigger the Buffer to clear to your log file), have the other appender write the “——-Error——–” text first with a newline before the text.

    You will have to play around with it a bit to get it to work, but this should be a workable solution. Apache does allow multiple appenders to write to the same file. Just make sure you put the +MinimalLock on your appenders so they don’t lock the file. Here is a SO link that explains how two appenders can write to the same file:

    Can Log4net have multiple appenders write to the same file?

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

Sidebar

Related Questions

This is my dilemma. I have a RollingFileAppender . I have a BufferingForwardingAppender .
have anyone can tell me what syntax error on this actionscript (actionscript3.0)? var rotY:
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have an app that can use tts to read text messages. It can also
Have one Doubt In MVC Architecture we can able to pass data from Controller
Have you guys met something similar? Exception type: System.ComponentModel.Win32Exception Exception message: The operation completed
Have some validating problems which seem to appear only when using the Auth component.
Have you managed to get Aptana Studio debugging to work? I tried following this,
Have a text box which get data for price. If someone enter something like
Have spent the morning on the examples page, and can't seem to spot why

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.