log4net

How do I register a custom IObjectRenderer in log4net?

I'm doing some research into using log4net, and I found the IObjectRenderer interface interesting. It would allow us to control how types are logged and provide a different, possibly more user-friendly ToString() implementation. I just started looking at log4net though, and can't seem to find a logical way to programmatically set up th...

What is tracing and how should it be done?

What is tracing and how should it be done? I have a common utilities library I am including in my projects and I want to be able to get some output from it. I have been using log4net but would rather not have my common utilities library dependent upon log4net. Does that make sense? Edit: Is there any correlation between logging and tr...

How fast is a log4net logging method (Debug, Info, etc)?

I'm a big fan of log4net, but recently, some (in my department) have questioned its inclusion in our projects because of the seemingly heaviness of each logging method. I would argue that there are better techniques than others, but that's another question. I'm curious to know, what is the typical impact of a log4net DebugFormat-type ca...

log4net not logging ThreadContext

I have log4net running on my AsP.NET site. I'm able to log messages to my DB Table, but it isn't logging the ThreadContext properties. For example: ThreadContext.Properties["Url"] = HttpContext.Current.Request.Url.ToString(); ThreadContext.Properties["HttpReferer"] = HttpContext.Current.Request.ServerVariables["HTTP_REFERER"]; My log4...

Setting a log file name to include current date in Log4j

I would like to set the log file name for a log4j and log4net appender to have the current date. We are doing Daily rollovers but the current log file does not have a date. The log file name format would be logname.2008-10-10.log Anyone know the best way for me to do this? edit: I forgot to mention that we would want to do this i...

Is log4net much slower than System.Diagnostics.Trace?

I'm investigating the differences between using log4net and System.Diagnostics.Trace for logging, and I'm curious about the performance differences I've observed. I created a test application to compare the performance of both logging methods in several scenarios, and I'm finding that log4net is significantly slower than the Trace class...

Logging Library for .NET Compact Framework?

Any good logging libraries that support .NET compact framework? ...

SharePoint and Log4Net

I'm looking for best practices to integrate log4net to SharePoint for web request, feature activation and all timer stuff. I have several subprojects in my farm, and I would like to have only one Log4Net.config file. [Edit] Not only I need to configure log4net for the web application, which is easy to do (I use global.asax, and a log...

How do I configure log4net so that log.IsDebugEnabled is true?

I am trying to use log4net in an ASP.NET application with Visual Studio 2005. I have declared an instance of the logger like so: Private Shared ReadOnly log As ILog = LogManager.GetLogger("") I am trying to use it in the following manner: If log.IsDebugEnabled Then log.Debug("Integration Services Constructed") End If Here is my ...

mixing log4cxx and log4net

I have a c++ application which logs to some file using log4cxx (RollingFile appender). I want to log into the same file, at the same time, from another module written in c#; so i configured log4net to use the same file, but i can't get the new messages in. If i deactivate the c++ logging, i can see c# messages. So i think it is a locking...

How do I force a rollover at application startup with Log4net RolloverFileAppender?

Have Log4Net configured in our application to use a date stamped name and a 10Meg file size limit. This automatically causes a rollover to a new file at midnight and whenever the 10Meg limit is reached. I would also like to roll over the logging to a new file each time the application is started (or closed). Can I get all three roll over...

log4net with ASP.NET 3.5 problems

I'm having some trouble getting log4net to work from ASP.NET 3.5. This is the first time I've tried to use log4net, I feel like I'm missing a piece of the puzzle. My project references the log4net assembly, and as far as I can tell, it is being deployed successfully on my server. My web.config contains the following: <configSections...

Fields people capture when logging - log4net

Hi guys I interested in knowing what fields people actual capture and use when logging within their applications when using loggers like log4net. This can range from debugging to testing to production and can be for thick client apps but I am thinking more about semantics of web apps (i.e. asp.net). Also, in the context of web (and ...

How do I get a helper method in a utility class to use its callers logger in log4net?

I have an executable that depending on the command line switch supplied looks something like: Program.cs - namespace DiskSpaceReporting { class Program { static void Main(string[] args) { if(args.Length == 1) { switch(args[0]) { case "-summarytotals": SummaryDiskSpaceReporter...

How much to log within an application??? How much is too much...

Hi guys Just wondering how much people log within their applications??? I have seen this: "I typically like to use the ERROR log level to log any exceptions that are caught by the application. I will use the INFO log level as a "first level" debugging scheme to show whenever I enter or exit a method. From there I use th...

log4net open database connections

I am using the AdoNetAppender to write to a SQL Server 2005 database table. I have bufferSize set to 1 so that entries are written immediately. My DBA is concerned that log4net is leaving its database connection open. We have ~50 connections to the database today but only 22 log entries. In several cases there are multiple connections f...

How do you get log4net's SmtpPickupDirAppender to use the IIS pickup directory?

Due to the nature of the live server I deploy to, my mail settings are using deliveryMethod="PickupDirectoryFromIis". I'm using log4net to send logs via email and I need find a way of getting it to do the same thing. I can see from the docs that there is an SmtpPickupDirAppender, which has a pickupDir setting. If I set this to whatever ...

How do I configure a RollingFileAppender to roll by date and size with log4net?

I am configure log4net to use a composite RollingFileAppender so that the current file is always named logfile.log and all subsequent files are named logfile-YYYY.MM.dd.seq.log where seq is the sequence number if a log exceeds a certain size within a single day. Unfortunately, I have had very little success in configuring such a setup. ...

Mock objects, nUnit, call log and log4net

A very often scenario of unit test is as follows: public void SetUp() { this.callLog = new StringBuilder(); } public void TestBuzzBar() { var bar = new Bar(new MockFoo(callLog)); bar.Buzz(17); Assert.AreEqual("MockFoo.Init(17) MockFoo.PrepareStuff MockFoo.DoTheJob ", callLog.ToString()); } ... with MockFoo implementing an IFo...

Log4Net or Logging Application Block

I need a logging framework in my application. I have two candidates: Log4Net and Logging from Application Block. Which is better? any specific advantage to any of them? Thanks ...