472,989 Members | 3,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 software developers and data experts.

log4net filtering


I know that log4net supports filtering based on properties
(log4net.Filter.PropertyFilter). Trouble is, I'm having trouble
spotting what valid property names are. Are they intrinsic to log4net
or are they defined by the appender/logger itself?

I would like to filter on a method name, for example, instead of the
message itself. PropertyFilter looks promising because MDCFilter and
NDCFilter are supposedly deprecated in favor of PropertyFilter
(according the the log4net documentation).

Any suggestions?

An appender that should get my question across is pasted below.


<appender name="RollingFile"
type="log4net.Appender.RollingFileAppender" >
<!-- Set up the log file name prefix -->
<file value="log" />
<!-- Append to the end of the file. -->
<appendToFile value="true" />
<!-- Roll by date (as opposed to size) -->
<rollingStyle value="Date" />
<!-- Date pattern to use for the file suffix -->
<datePattern value="yyyyMMdd" />
<!-- Layout for the file messages -->
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger
[%property{NDC}] - %message%newline" />
<!-- ignore MyMethod messages.-->
<filter type="log4net.Filter.PropertyFilter">
<key value="MethodName"/>
<stringToMatch value="MyMethod"/>
<acceptOnMatch value="false"/>
Jun 27 '08 #1
0 1418

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: SK | last post by:
Hi, I am using log4net in my c# application.Want to know how to customize the log output format. I know that it can be done using LayoutSkeleton class,but dont know what other parameters to be...
by: anonieko | last post by:
Add a reference to log4net.dll 1: In the APP.CONFIG write the following: <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="log4net"...
by: Joneleth | last post by:
Hi, anyone can help with log4net? i'm not sure i understand log4net object model properly... i'm trying to configure log4net programmatically, in order to assign different custom appenders to...
by: Gawel | last post by:
hajo, can someone send me an example how to use above pattern in asp.net applicaiton? I can not figure out how to do it. I get no exceptions, simply no logging occures. Thanks for any info ...
by: Vikram | last post by:
I am using log4net in a vb.net console application. But its not working. I have added congif setting in app.config file also No error is generated but app. does not write to log file. ...
by: Mr Flibble | last post by:
Hi all, I've decided to use log4net for my logging/tracing. In the example on the site it shows using main() to setup the root logger and then using the LogManager within your classes to...
by: Marc Scheuner | last post by:
Folks, I'd really like to use log4net for our error logging, but I'm having two problems: 1) For certain cases, I'd like to log error and messages to text files. I tried both the regular...
by: chidam.chidam | last post by:
Hi all, I would like to implement log4net for logging my application. First let me describe in short about the application. I have a solution with two exe file outputs and several dll assemblies....
by: forest demon | last post by:
I need to be able to create an appender to direct output to a MessageBox. The API does not have a MessageBox appender like nLog does. What would be the easiest way to do this. The examples...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.