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

Ask A Question

Stats

  • Questions 255k
  • Answers 255k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer you can create some viewController class to represent your waiting… May 13, 2026 at 10:26 am
  • Editorial Team
    Editorial Team added an answer You could use the grep options -oE, possibly in combination… May 13, 2026 at 10:25 am
  • Editorial Team
    Editorial Team added an answer The only way to get that error is if the… May 13, 2026 at 10:25 am

Related Questions

I am using the FileInfo class. However, the file info cannot find the file.
I am playing with class generation ( one class for a table - inheritance
What are the scoping rules for variables in a jsp page with pages added
Our applications use lot of custom built and third party libraries and right now

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.