log4net

Using uniqueidentifiers/guids as custom properties in log4net

I'm trying to add a custom property which is a guid, but it gives me this error: System.InvalidCastException: Failed to convert parameter value from a String to a Guid. ---> System.InvalidCastException: Invalid cast from 'System.String' to 'System.Guid'. I specify this in the config: <parameter> <parameterName value="@id...

VS2005: Assembly '<assembly>' is incorrectly specified as a file.

i've added a reference to the log4net assembly dll to my project. When i build i get a warning saying: Warning Assembly 'Lib\log4net.dll' is incorrectly specified as a file. i look up the help for this error on MSDN, and it says: This warning is generated during application manifest generation when the build process de...

log4net strategy on named loggers?

I typically declare the following in every class: private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); and use the static member within each class to log at different levels (info, debug, etc.) I saw that somewhere and have been using it s...

log4Net config in external file does not work

We are using log4net and want to specify it's configuration in an external config file (as we have done with other sections). To do this we have changed the log4net section in the App.config to: ... <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/> ... <log4net configSource="Log.config" /...

How to specifiy common application data folder for log4net?

I want log4net to write log files (using RollingFileAppender) to a subfolder of the common application data folder (e.g. C:\Documents and Settings\All Users\Application Data\Company\Product\Logs). However, on Win XP, there is no environment variable that specifies this folder. We have %ALLUSERSPROFILE%, we have %APPDATA%, but there is no...

How to log SQL calls with NHibernate to the console of Visual Studio?

I have the following configuration file for NHibernate: <?xml version="1.0" encoding="utf-8" ?> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <session-factory> <property name="connection.connection_string">Server=.\SQLEXPRESS;Database=mydb;Integrated Security=True;</property> <property name="dialect">NHibe...

.NET: Looking for best performing appender of log4net

We are currently using the log4net appender (web.config snippet): <appender name="FileAppender" type="log4net.Appender.RollingFileAppender"> Looking for experience using other appenders. ...

How to log Trace messages with log4net?

I'm using log4net to log write log message to a rolling log file. Now I would also redirect all trace messages from System.Diagnostics.Trace to that log file. How can I configure that? I tried to find anything about that in the log4net documentation, but without success. Is it possible at all? The reason I want to do that is because I...

log4net nested loggers .config example

Hi, I'm working on setting up log4net in a multi-tiered application. I have most of my logging set up as desired, but now I'm trying to get the entries in .config set up in a way to allow maximum flexibility on the levels being output. My logger naming convention goes something like: ExecutableName.WorkerThreadName.[ExternalModuleName...

Append current Date to Log file with Log4Net

Hello, All I want to do is append the current date and time to my log file, say: "export_(Wed_Feb_21_2009_at_1_36_41PM)" Here is my current config from my app.config <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="c:\export.txt" /> <appendToFile value="true" /> <lockingModel type=...

C# Application can't read/write to files created by administrator when run in limited user account XP

I have an application that is useable by all users (admin or limited) in .NET (C# specifically). When the application first launches - it creates a few files that it needs in the C:\Documents and Settings\All Users\Documents\ for all subsequent launches. If the limited user in XP is the FIRST user to launch the application it creates t...

How do I Filter on a custom Level in log4net?

I copied the log4net samples to implement a custom log level, AUDIT. I defined AUDIT to have a value of 35000, between DEBUG 30000 and INFO 40000. The following is my configuration section. I have one appender that logs all levels and one that is supposed to log only AUDIT levels (this is just for testing) <log4net> <appender name="F...

limiting emails from smtpappender (log4Net)

I am looking for a way to limit SmtpAppender to limit number of emails sent in case of same error is occurred multiple times in a defined time span. I don't know if it is even possible, any help will be appreciated ...

log4net vs MS Logging Application Block

I am trying to understand pros and cons of using log4netor enterprise library logging application block (LAB) for logging in application. I know one thing LAB is little difficult to use then log4net. ...

log4net, logging, what is the biggest advantages

How do you best take advantage of your logs and logging tools aside from the obvious that you have gigabytes of text telling you everything your app is doing. I am not currently using any logging in my private projects, only sending an email to myself whenever a unexpected exception occurs and I find this sufficient for my use and I cann...

Can't get Log4Net to work in our WCF application

We are trying to use Log4Net to log from our IIS 6-deployed WCF Application. We are trying to log to a file, but can't seem to get the log files to be created, let alone see the logging output in them. The pertinent pieces of out web.config are: <sectionGroup name="common"> <section name="logging" type="Common.Logging.Configuratio...

Logging errors/exceptions with log4net

Hi all, I'm trying to log all exceptions to a sql server database through log4net, and I've seen some posts here explaining how to properly configure the web.config file, but my question is: do it is enough to get the exception logged (the application will log automatically, but in this case it does not work on my app), or do I have to...

log4net file names based on GlobalContext properties

I'm trying to customise a log4net file path to use a property I have set in the log4net.GlobalContext.Properties dictionary. In my application code: log4net.GlobalContext.Properties["LogPathModifier"] = "SomeValue"; I can see that this value is set correctly when debugging through it. and then in my configuration: <file type="log4ne...

Best way to dynamically set an appender file path

I am trying to find somebody smarter than me to validate some syntax I wrote up. The idea is to configure the filename of my RollingFileAppender to the name of the assembly in order to make it more re-usable for my projects. I've seen this previous SO article but it wasn't exactly able to answer my question... I've had a dickens of ...

Failing NUnit test when running through CC.NET

The solution for this error has escaped me for several days now, and it is time to come here for help. The short version is, I have a unit test that fails on the build server but no other environment. The method I'm testing is an extension method for ILog in log4net. The purpose of this extension method is to make a debug log of the cur...