Where will log4net create this log file?

If you want your log file to be place at a specified location which will be decided at run time may be your project output directory then you can configure your .config file entry in that way <file type=”log4net.Util.PatternString” value=”%property{LogFileName}.txt” /> and then in the code before calling log4net configure, set the new path like … Read more

Log4Net config in external file does not work

Do you have the following attribute in your AssemblyInfo.cs file: [assembly: log4net.Config.XmlConfigurator(ConfigFile = “Log4Net.config”, Watch = true)] and code like this at the start of each class that requires logging functionality: private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); I have a blog post containing this and other info here.

Log4Net, how to add a custom field to my logging

1) Modify the command text: INSERT INTO Log4Net ([Date],[Thread],[Level],[Logger],[Message],[Exception],[MyColumn]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception, @CustomColumn) 2) Add the parameter definition for the custom column: <parameter> <parameterName value=”@CustomColumn”/> <dbType value=”String” /> <size value=”255″ /> <layout type=”log4net.Layout.PatternLayout”> <conversionPattern value=”%property{CustomColumn}” /> </layout> </parameter> 3) Then use one of log4net’s contexts to transfer values to the parameter: … Read more

How do I resolve configuration errors with Nant 0.91?

Oddly enough, this is related to how the executables are extracted from the Nant 0.91 archive. (This made no sense to me until I actually tried it, but it does actually work…) Source : http://surfjungle.blogspot.com/2011/11/tip-running-nant-091-on-windows-7.html I found that the problem was Windows 7 security related in that the downloaded NAnt 0.91 zip file needed additional … Read more

What is the difference between log4net and ELMAH?

Log4Net is a general purpose logging framework with an API intended to be used within your application (web, console, dll, etc.). logger.Debug(“Some low level debug message…”); logger.Info(“Some basic info”); logger.Warn(“Some business logic problem, but not critical”); logger.Error(“An unexpected error”); ELMAH is an unobtrusive IIS plugin specifically for logging exceptions in a web application. You won’t … Read more

Intermittent log4net RollingFileAppender locked file issue

Try adding <lockingModel type=”log4net.Appender.FileAppender+MinimalLock” /> to your <appender /> element. There is some performance impact because this means that log4net will lock the file, write to it, and unlock it for each write operation (as opposed to the default behavior, which acquires and holds onto the lock for a long time). One implication of the … Read more

log4net not working

One gotcha for this type of thing is to make sure to add the XmlConfigurator attribute to the assembly by placing the following line in your AssemblyInfo.cs: [assembly: log4net.Config.XmlConfigurator] Otherwise log4net never activates.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)