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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:33:23+00:00 2026-05-11T08:33:23+00:00

I copied the log4net samples to implement a custom log level, AUDIT. I defined

  • 0

I copied the log4net samples to implement a custom log level, AUDIT. I defined AUDIT to have a value of 35000, between DEBUG 30000 and INFO 40000.

The following is my configuration section. I have one appender that logs all levels and one that is supposed to log only AUDIT levels (this is just for testing)

<log4net>   <appender name='FileAppender' type='log4net.Appender.FileAppender' >     <file value='testrun.log' />     <layout type='log4net.Layout.PatternLayout' >       <conversionPattern value='%date{HH:mm:ss:fff} [%thread] %-5level %logger{1} - %message%newline' />     </layout>   </appender>   <appender name='FileAppender.Audit' type='log4net.Appender.FileAppender' >     <filter type='log4net.Filter.LevelMatchFilter'>       <levelToMatch value='AUDIT' />     </filter>     <file value='testrun.audit.log' />     <layout type='log4net.Layout.PatternLayout' >       <conversionPattern value='%date{HH:mm:ss:fff} [%thread] %-5level %logger{1} - %message%newline' />     </layout>   </appender>     <root>     <level value='ALL' />     <appender-ref ref='FileAppender' />     <appender-ref ref='FileAppender.Audit' />   </root> </log4net> 

The test method is

private static readonly IAuditLog log = AuditLogManager.GetLogger(typeof(Program)); public static void Main() {     log.Debug('Debug');     log.Audit('Audit');     log.Info('Info'); } 

However, the output of the appenders is the same…

13:09:11:540 [9] DEBUG Program - Debug 13:09:11:560 [9] AUDIT Program - Audit 13:09:11:560 [9] INFO  Program - Info 

The log4net debug output when parsing the LevelMatchFilter is

log4net: Loading Appender [FileAppender.Audit] type: [log4net.Appender.FileAppender] log4net:ERROR XmlHierarchyConfigurator: Unknown Level Specified [AUDIT] log4net:WARN Unable to set property [levelToMatch] on object [log4net.Filter.LevelMatchFilter] using value [AUDIT] (with acceptable conversion types) log4net: Setting Collection Property [AddFilter] to object [log4net.Filter.LevelMatchFilter] 
  • 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. 2026-05-11T08:33:23+00:00Added an answer on May 11, 2026 at 8:33 am

    log4net version 1.2.10 requires that you end a LevelMatchFilter chain with a DenyAllFilter if you want the behavior I described in the question.

    <appender name='FileAppender.Audit' type='log4net.Appender.FileAppender' >   <filter type='log4net.Filter.LevelMatchFilter'>     <levelToMatch value='AUDIT' />   </filter>   <filter type='log4net.Filter.DenyAllFilter' />   <file value='testrun.audit.log' />   <layout type='log4net.Layout.PatternLayout' >     <conversionPattern value='%date{HH:mm:ss:fff} [%thread] %-5level %logger{1} - %message%newline' />   </layout> </appender> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which get copied and run on client machines. The program
I have two projects configured identically for log4net. One project logs fine; however, the
I copied over my project to another PC. I have a reference to a
I copied the exact codes from my textbook and I have the following errors.
I have copied a very simple JQuery delayed overlay popup into Wordpress, yet it's
I have an icon (57x57 pixels) which I copied to recources folder and added
I copied some Delphi code from one project to another, and found that it
I use RegexBuddy while working with regular expressions. From its library I copied the
I recently started building a console version of a web application. I copied my
Our applications use lot of custom built and third party libraries and right now

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.