log4net

Is there a way of filtering System.Diagnostics.Trace.WriteLine() output

log4net logging internal logs to console and trace and I want to redirect the trace output to system EventLog. But in some points later perhaps I will need to issue trace messages from my code so I need to filter somehow the log4net traces. I could not find a way to do that. System.Diagnostics.SourceFilter or a custom filter doens't sens...

Using Castle for logging thrown exceptions in WCF (and otherwise)

Hello, I'm writing a WCF web service and I'm wondering if there's an elegant (aspect-oriented) way to use Castle interceptor mechanism for logging exceptions thrown by my web methods? I know about the IInterceptor inteface, but I could not find any exception information there. I've seen http://stackoverflow.com/questions/238755/castle...

log4net vs. Nlog

Anyone have experience for both? How do they stack up against each other? We are planning on using one of them for logging in an enterprise application. References: log4net nlog EDIT: We have no existing dependencies to either nlog or log4net. ...

How can I set the conversionPattern for a Log4Net Console Appender to clear the screen

I want my console appender to clear out the screen before each new write so there is only 1 msg displaying at a time. I have a second file appender to show the history. I was hoping for something like this: <appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender" <layout type="log4net.Layout.PatternL...

Change log4net logging level programatically

This is similar to 650694 but no answer was accepted there, I can't get any of those suggestions to work at all, and I suspect I may be in a slightly different situation. I'm calling log4net.Config.XmlConfigurator.Configure(). But after that point in the program, I want to change the logging threshold to a value only known at runtime. ...

Configure Log4Net for NHibernate

This has got to be a lamer question: In my test project I am attempting to configure log4net. The following method call gives the error. BasicConfigurator.Configure(); "type name expected but method found" What am I overlooking? Thanks, Nick ...

log4net only logs when running in the Visual Studio debugger.

I'm running Visual Studio 2008 - and have a problem with log4net logging (v1.2.10). I have a small console test program with a single log statement. I have log4net configured for RollingLogFileAppender and ConsoleAppender. When I run the compiled exe from the command line, I see the correct creation of the log file in my runtime direct...

Best practice(s) for on screen real-time log viewer for log4net

I have a multi-threaded C# application that use log4net for logging capabilities. Mainly the RollingFileAppender. I want to offer the capability for the user to view the activity of the application in an "application log" window. This will consist of a listview (details mode), a grid or something similar. I'm looking for best ways to d...

Spring.Net logging with Log4Net not working

I'm having trouble getting Spring.Net to log, using Log4Net. I'm particulary interested in seeing logging around the Aspects. I'm using a pretty simple log config, similar to that of the MovieFinder example app: ... <logger name="Spring"> <level value="DEBUG" /> <!-- Have tried INFO as well, no different --> <appender-ref ref="Sprin...

Log4NET setting overwritten by AssemblyInfo Task

I have a project that uses log4net and works fine on the developer machines. When we build, a step in our build scripts calls the AssemblyInfo task to set version numbers and dates, etc. But the AssemblyInfo file also loses the line: [assembly: XmlConfigurator(Watch = true)] Is there any way to have the AssemblyInfo task not overwri...

Log4Net RollingFileAppender with composite rolling style is overwritting data

I have a Log4Net RollingFileAppender that is configured as: <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/> </configSections> <log4net> <root> <level value="ALL" /> </root> <logger name="RollingFileAppender" additivity="false"> ...

Dynamically reconfigure Log4Net

I'm looking for tips on the best way to reconfigure the Log4Net logging level dynamically in my ASP.NET apps. I generally use a simple configuration where the root logger defines the default logging level, e.g. <log4net> <root> <level value="INFO" /> <appender-ref ref="..." /> <appender-ref ref="..." /> ... etc ... ...

Weird Silverlight Designer Error

I get the following exception loading any Xaml in my project: '/Microsoft.VisualStudio.Xaml;Component/MS/Internal/Designer/PropertyEditing/Resources/StylesCore.Constants.xaml' value cannot be assigned to property 'Source' of object 'System.Windows.ResourceDictionary'. Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=n...

Can you filter on Logger level in log4net

I am want to filter out messages that contain specified string. I used log4net.Filter.StringMatchFilter but that applies to appenders only. I'd like to filter that message on Logger level already. Something along these lines: <logger name="MyLogger.WebServices"> <level value="Debug" /> <filter type="log4net.Filter.StringMatchFilter">...

Where can I write my log4net log file to under ClickOnce?

When I run my application locally it writes my log4net log to the location I've configured (i.e., <file value="${LOCALAPPDATA}\TEST\Logs\debug.log" />) without a problem. However, when I deploy my application via ClickOnce, the log file is not being written. I know ClickOnce applications are limited in terms of where they can write t...

How to track down log4net problems

I use log4net all the time, but one thing I've never figured out is how to tell what's going on on the inside. For example, I've got a console appender and a database appender in my project. I made a few changes to the database and the code, and now the database appender doesn't work anymore. I'll figure out why eventually, but it would ...

Grouping log4net errors by similarity

We use log4net for logging application exceptions for a variety of web applications. At present we use the RollingLogFileAppender with a threshold of Info and SmtpAppender with a threshold of Warn. The problem is that we have no easy way of grouping error log entries by their contents. There are certain errors that we see frequently, an...

Could not load file or assembly 'log4net

Ok I am having a very odd issue when deploying one of our web applications to our live servers. Our application uses log4net to log a lot of actions quite heavily and after a couple of hours after being deployed we get the following exception. Could not load file or assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b3...

How to configure log4net programmatically from scratch (no config)

This is a Bad Idea, I know, but... I want to configure log4net programmatically from scratch with no config file. I'm working on a simple logging application for me and my team to use for a bunch of relatively small departmental applications we're responsible for. I want them to all log to the same database. The logging application is ju...

Log4net/Logging - What have you found to be useful?

I just started using Log4Net and was looking to see what you have found to be useful in your logging experiences. What types of things have you found to be useful to log; what ended up being just noise; when do you use the different logging levels (DEBUG, INFO, etc); do you have a standard format for each log entry; are there things you...