log4net

log4net is single threaded??

Reading the docs on log4net, I noticed that all the std Appenders are labeled as "not safe for multithreaded operations" This makes it sound like none of the Appenders can be used in ASP.Net or a multi-threaded client. Am I mis-reading this? Has anyone encountered problems with threaded log4net Appenders?? Thanks --- Chris ...

log4net filtering on exception message?

How can I filter logging based on a logged exception's message? Code looks like this: try { someService.DoSomeWorkflow(); } catch(Exception e) { log.Error("Hey I have an error", e); } Config looks like this: <appender name="EventLogger" type="log4net.Appender.EventLogAppender"> <applicationName value="foo" /> <lay...

ETW tracking from .net, user mode and driver

Hi everyone, We have an application that parts of it are in .net, c++ usermode and C++ drivers. The application is divided into several executables that run on demand and communication with each other using LPC(the processes run in different sessions(winlogon)). Currently We have a home written logging service to which .net and c++ use...

How do I only keep the most recent n entries in a log4net sql table?

I am using log4net to log to a sql table. I'd like to be able to either only keep the most recent n days, or the most recent n entries in the table. Is this possible with log4net? ...

log4net custom log objects and appender

I'd like to extend log4net to accept custom log objects as parameter. For example: public class MyLogObject { public string PropA; public int PropB; } private MyLogObject entry = new MyLogObject() {PropA = "FooBar", PropB = 1}; Log.Debug(entry); ... this should work similar to exceptions. In t...

Log4Net multiple SMTP appenders?

I have configured a SMTP appender to send an email whenever there's an error. <appender name="EmailAppender"> <bufferSize value="50" /> <lossy value="false" /> <threshold value="ALL" /> <evaluator type="log4net.Core.LevelEvaluator,log4net"> <threshold value="ERROR" /> </evaluator> </appender> I need to also get an email...

Ninject 2, logging, and WebForms

The officially released Ninject 2 no longer includes reference to the WebForms-specific functionality for IoC for WebForms, MasterPages, etc. It's now separated out into plugins/extensions; which in this case is the http://github.com/idavis/ninject.web extension. My problem however is that there's a dependency on log4net (or NLog) and I ...

log4net save buffer from BufferedAppender

Hi, we are using log4net with a AdoNetAppender to write critical logs into an database. Since the AdoNetAppender is a subclass of the BufferedAppender there is a possibility to enable queuing of log events. What I'd like to do is to save the backup & restore the log buffer to a local file, so that no log entry can get lost it the databa...

Reading log from Log4Net generated by multiple threads

I have a script that has multiple threads running in parallel. These threads write to a Log4Net RollingFileAppender file. Reading this log is a quite confusing since all the thread logs are mixed up. Im wondering what is a good way to write these logs, and what is the best way to read these files so reading the debugging information of a...

Silverlight: Log4Net to Isolated Storage

First, i know about clog and i do not want to implement this piece. the reason? we can't maintain severeal logging 'frameworks'. So to my question: Has somebody successfully implemented log4net in a silverlight application? what i want to achieve is logging to the isolated storage. i know, there's only 1mb of storage available but thi...

how can i set sitename from IIS in to my log4net created file

I am using log4net in my .NET projects and logs are being created with names like: C:\\Inetpub\\zz_appLogs\\<hard coded sitename>\\<yyyyMMdd>\\<hard coded file name with txt extension> Now I want to change the log file name with current site name in IIS. I have tried this in log4net settings but it didnt work: <file type="log4net.Util...

How I can set log4net to log my files into different folders each day?

I want to save all logs during each day in folder named YYYYMMdd - log4net should handle creating new folder depending on system datetime - how I can setup this? I want to save all logs during the day to n files of 1MB - I don't want to rewrite old files but to really have all logs during one day - how I can setup this? I am usin C# ...

Is there a difference between log4net.Config.BasicConfigurator.Configure() and log4net.Config.XmlConfigurator.Configure() ?

Hi folks, I'm using log4Net for my logging. I also have the following set... <log4net debug="true"> .. </> Ok, now, when i have the following code log4net.Config.BasicConfigurator.Configure(); I don't really get any verbose internal-debug info but I do get displayed anything I log. Now, when i swap that code out and replace it wi...

What happens to the output to a log4net console appender in a Windows service?

I have a console project that I have been working on. I added log4net to handle all my logging. In some places I have made use of the console appender. When I turn this application into a Windows Service should I just remove the console appender or what happens to that output? Does it just get lost? I would like to keep it if all possi...

log4net: log information into different log files

I have the following configurations in my web.config file, but how can I log the information into data.txt and general.txt separately in C#? Could anyone provide some sample code for me? <appender name="GeneralLog" type="log4net.Appender.RollingFileAppender"> <file value="App_Data/Logs/general.txt" /> <appendToFile value="true" /...

Prevent log4net to send duplicate issues via SMTP

Hi, we have bridged our log4net with Jira using SMTP. Now we are worried that since the site is public what could happen to the Jira server if we get alot of issues in the production environment. We have already filtered on Critical and Fatal, but we want to see either some acumulator service on log4net or a plain filter which identi...

Logging InnerException using Log4Net

How do I log inner exception with Log4NET? This is my current conversion pattern: <conversionPattern value="%date [%appdomain] %-5level %logger [%property{NDC}] - %message%newline" /> ...

Log4Net performance

I have written a C# app that runs constantly in a loop and several threads write to a log4net file. The issue is that the longer the app is running, the more time it takes to complete a loop. I have run a ANTS Performance profiler, and noticed that most of this CPU time is spent logging with log4.net. The more verbose the logs the mor...

Naming a file generated using Log4net

I am using log4net to generate logs in my applicaiton. My requirement was to generate logs every minute. I have achieved this using RollingMode.Date. These files are named like: name.log.yyyyMMdd-HHmm. But my requirement is to generate the files with name like: name.log.n where n will be sequential number. Any help?? ...

Is there a way to set the maximum number of error messages a log4net memory appender can contain?

I would like to add a memory appender to the root logger so that I can connect to the application and get the last 10 events. I only ever want to keep the last 10. I am worried about this appender consuming all too much memory. The application is designed to run 24/7. Or is there another way? ...