log4net

How can you delete old log4net logfiles?

Hello, We have an application that logs using log4net. But we would like to delete the logfiles every 4 weeks (automatically). Is there an option in log4net to do this or do we need to have a work arround? Cheers, M. this is my configuration <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> ...

Using other log4net logging levels than the usual ones

Hi, I've realised that there is more levels than all, debug, info, warn, error and fatal, they are listed in the log4net.Core.Level class. But how can I use them? I mean, in the ILog interface you have methods to use the usual ones, but what if you want to use "Fine" or "Emergency", etc? Cheers. ...

Log4Net and GAC - How to reference Configuraition Files?

Hello all I am using log4net during my development, as as part of a project constraint, I now need to add it to the Global Assembly Cache. The logging definitions are in a file Log4Net.xml. That file is referenced in my assemblyinfo as: [assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.xml", Watch = true)]. So long as t...

Count number of queries executed by NHibernate in a unit test

In some unit/integration tests of the code we wish to check that correct usage of the second level cache is being employed by our code. Based on the code presented by Ayende here: http://ayende.com/Blog/archive/2006/09/07/MeasuringNHibernatesQueriesPerPage.aspx I wrote a simple class for doing just that: public class QueryCounter : I...

Can writing to logfiles seriously slow down your application?

I'm using Log4Net to write logs to files. Can this serioulsy slow down my application? I know it depends on how much I'm writing away, but let's say that some hundreds of logs can be written per second. ...

How can I get the previous logged events when a particular logger is triggered?

I need to show the previous 10 events when a particular logger is triggered. The goal is to show what previous steps occurred immediately before NHibernate.SQL logging was issued. Currently, I am logging NHibernate sql to a separate file - this is working correctly. <appender name="NHibernateSqlAppender" type="log4net.Appender.RollingF...

Coordinated logging in a SharePoint farm

We are deploying web parts to SharePoint 2007 and would like to include logging (log4net). The ideal solution would be to use a database appender to avoid the problems with knowing which actual server is executing the web part. This questions has been helpful: http://stackoverflow.com/questions/219668/sharepoint-and-log4net. I've got ...

Second WPF project in one solution gives log4Net error

I am totally confused with the following error. I have my application which works perfectly fine and uses log4net for logging. I will now be implementing my own updater system. And I want it to be part of my solution. I have added a new WPF Application to my Solution and when I try to edit the main window or any other window in that p...

log4net logging problem

Hello everyone, I'm not sure if this is the right forum to post this question. But I'm just hoping someone here might have used log4net in the past, so hoping to get some help. I'm using log4net to log my exceptions. The configuration settings look like this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> ...

Is it possible to easily modify the log4net section in the config file of several running applications remotely?

Dear ladies and sirs. Our product consists of client, server and agents. Each deployed on different machines. The QA is having a hard time to manipulate the log4net sections in the respective config files. Right now, they have to have remote desktops to all the relevant machines and open notepad in each of them and then edit the files on...

Using log4net as a logging mechanism for SSIS?

Does anyone know if it is possible to do logging in SSIS (SQL Server Integration Services) via log4net? If so, any pointers and pitfalls to be aware of? How's the deployment story? I know the best solution to my problem is to not use SSIS. The reality is that as much as I hate this POS technology, the company I work with encourages the...

How can I display an Error Message when my program can't connect to database?

Hi, I need to know a way to show a message or something like that when I compile my program and the user or password are wrong, because when I do this nothing happens. I'm making a system that save logs. log4net just using C#. if you can help me I'd appreciate. thanks! ...

How Can I tell where log4net thinks it's getting it's config file from?

Hi, I have the following log from the log4net debug log: log4net: DefaultRepositorySelector: repository [log4net-default-repository] already exists, using repository type [log4net.Repository.Hierarchy.Hierarchy] log4net: XmlConfigurator: configuring repository [log4net-default-repository] using file [log4net.config] watching for file ...

log4net - configure using multiple configuration files

Hi, I have an application consisting of a host and pluggable modules (plugins). I want to be able to configure log4net for the host and for each of the other modules. Each of them should have its own configuration file and each will log to a different file. Only the host has an App.config file. The plugins have their own config fil...

log4net 1.2 RollingFileAppender not working

Hi Guys, I'm using log4net v1.2 with a Windows Service App. My RollingFileAppender seems not to work. I'm pasting the logging sections of my service.exe.config below. Can anyone advise where m going wrong? <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/> .....(lots of other config stuff) <app...

Log4net duplicate logging entires

I recently switched out log4net logging from using config files to being set up programmatically. This has resulted in the nhiberate entries getting repeated 2 or sometimes 3 times. Here's the code. It uses a string which looks something like this "logger1|debug,logger2|info" private void SetupLog4netLoggers() { IAppe...

Writing to a log4net FileAppender with multiple threads performance problems

TickZoom is a very high performance app which uses it's own parallelization library and multiple O/S threads for smooth utilization of multi-core computers. The app hits a bottleneck where users need to write information to a LogAppender from separate O/S threads. The FileAppender uses the MinimalLock feature so that each thread can lo...

log4net: what am I doing wrong?

Being a log4net newb / boob I just copied lines from an NHibernate example project where I can see the log.txt file is updated. Is there a quick answer why mine isn't creating the file? Cheers, Berryl [assembly: log4net.Config.XmlConfigurator(Watch = true)] I saw another post here saying this should go in AssemblyInfo, but in the exa...

log4net configuration problem

I have a seperate Log4Net.config file. I added [assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)] to AssemblyInfo.cs When I run the application with debug mode, lognet is logging. When i publish the application to IIS, lognet is not logging anything. I have the followings also : BasicConfigurat...

Configuring log4net appenders via XML file *and* code

I started to play with log4net today and so far, I really like it. In order to preserve our current logging functionality, the app needs to create a new log file whenever the application is started. The log file name has the date and time stamp encoded in it. Currently, I've got log4net configured via an XmlConfigurator, which works g...