karlkras | 9 Apr 19:17 2015

Can't get RollingFileAppender to work...

Hello again. So I'm trying to configure a RollingFileAppender logger to work
against a custom level. However, when I call the custom level no file with
content is created/produced.
The xml configuration looks like this:

<?xml version="1.0" encoding="utf-8"?>
		<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"
requirePermission="false" />
	<log4net debug="True">
			<name value="AUDIT" />
			<value value="80000" />
			<appender-ref ref="LogglyLogger" >
				<threshold value="DEBUG" />
		<logger name="EventLogger" additivity="False">
			<level value="ERROR"/>
		<logger name="RollingFile" additivity="False">
			<level value="AUDIT"/>
		<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
(Continue reading)

karlkras | 8 Apr 01:13 2015

How to use a custom level in logger interface...

So I've found a sample that states to add a custom level to the log4net xml
configuration as such:
	        <name value="AUDIT" />
		<value value="80000" />

and I'm guessing I can define my logger to use it like this:

		<logger name="RollingFile" additivity="False">
			<level value="AUDIT"/>

in in the C# code, how do I specify to call the logger to call the logger
with the "AUDIT" level? e.g., for an Error level message I perform an
log4net.ILog.Error(...) call.

what do I do for the custom level since this support isn't built in, i.e.,
how/where do I inject the handlers for interact with the log4net process?


View this message in context: http://apache-logging.6191.n7.nabble.com/How-to-use-a-custom-level-in-logger-interface-tp54520.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

DeveloperM | 7 Apr 15:44 2015

Logging works in VS but not when deployed

(Apologizing for cross-posting...)

I am working in a Dynamics CRM 2011on-premises C# .Net environment. This is
the first time I have used log4net so bear with me, please...

My app.config entry for log4net is:
<appender name="RollingFileAppender"
  <file value="EDI File Generator Log.txt" />
  <appendToFile value="true" />
  <rollingStyle value="Size" />
  <maxSizeRollBackups value="10" />
  <maximumFileSize value="20MB" />
  <staticLogFileName value="true" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date [%thread] %level %logger -
%message%newline" />
  <level value="INFO"/>
  <appender-ref ref="RollingFileAppender"/>


In the program I have coded:
private static readonly ILog log =

(Continue reading)

Nicholas Dudas | 27 Mar 19:51 2015

Fwd: FileAppender ObjectDisposedException

I may have found a small bug in the file appender where the manual reset event is not cleaned up correctly during shutdown. 


Joseph L. Casale | 6 Mar 22:01 2015

Custom appender instantiation

I have a custom appender that uses parameters from the App.config file, however
I need to call an internal method after instantiation once the fields have been populated.

I see PreAppendCheck
Gert Kello | 5 Mar 13:01 2015

Debug info file for log4net release


Is it possible to download the log4net.pdb file for log4net-1.2.13-bin-newkey.zip? So that debugging log4net would be possible without making custom build.

Is there some reason why it is not included in zip? Would You consider adding it to coming releases?


Gert Kello | 4 Mar 09:27 2015

AppenderSkeletion lock in DoAppend


I'm trying to create a database appender which high throughput... I looked at code in AppenderSekeletion.DoAppend() method and saw following comment:

    public void DoAppend(LoggingEvent loggingEvent)
      // This lock is absolutely critical for correct formatting
      // of the message in a multi-threaded environment.  Without
      // this, the message may be broken up into elements from
      // multiple thread contexts (like get the wrong thread ID).

      lock (this)

I would like to remove this lock from my code but there's a couple of issues I do not understand:
1. As I do not know the internals of log4net well enough I do not understand why lock is important for message formatting? Is it because the Layout.Format is not supposed to be thread safe? Or is it because the same instance of m_renderWriter could be used by multiple threads (well, usage of m_renderWriter is protected by another lock, added later. But AFAIK the RenderLoggingEvent(LoggingEvent loggingEvent) is still not 100% thread safe)
2. The comment does not mention that lock is crucial for m_recursiveGuard to work correctly. That's my main complaint: I almost overlooked the issue of potentially skipped logging events.
3. What about implementations of IFilter.Decide? Are those (supposed to be) thread safe?

Thiemo.Kellner | 26 Feb 13:36 2015

64bit problem?

Hi all


I am at my wits’ end. We developped PowerShell script which uses log4net. I can run the script successfully from a batch file on my laptop but on the server I get


Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem'

provider failed.

I:\WA_ANALYSE\AAA_INFA_CORE\Scripts\metadata_join_params-thiemo.ps1 :

Exception calling "LoadFile" with "1" argument(s): "The parameter is

incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"

At line:1 char:1

+ I:\WA_ANALYSE\AAA_INFA_CORE\Scripts\metadata_join_params-thiemo.ps1

-stat_activi ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep


    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio




I found http://stackoverflow.com/questions/10249406/powershell-v2-load-a-com-interop-dll which points to a possible problem with mixing 32 dlls in 64 bit PowerShell. As my laptop is 32 and the server 64 bit, I was wondering if this might cause the problem. At least I could pin the line of code where the exception gets thrown: [void][Reflection.Assembly]::LoadFile($log4netDllPathString)


Has anyone an idea?


Liebe Grüsse/Cordialement/Cordialità


Thiemo Kellner



Office fédéral de la statistique
Espace de l'Europe 10
2010 Neuchâtel / Suisse


Tel     +41 32 71 36516


Christopher Landry | 12 Feb 21:00 2015

Dynamically change log levels confined to ThreadContext

I have a web app, and I’m trying to allow users to set the logging level via a query parameter. Got this working pretty easily.


The issue is that it doesn’t just change the logging level for that request, it’s changed for all requests that come in during the life cycle of that request – since I’m setting it back to the default level when the request is resolved.


I have tried adding the following in my appender, but it’s not working as I hoped.


<evaluator type=”log4net.spi.LevelEvaluator”>


           <layout type=”log4net.Layout.RawPropertyLayout”>

                <key value=”LogLevel” />




And set a ThreadContext property called LogLevel to the appropriate level, but that doesn’t seem to work either.


Any thoughts? Have I missed something obvious?



emacslisp | 9 Feb 02:53 2015

how to make log4net exclude Stack Trace

By default, log4net will log Stack Trace.

I create a wraper which inherit from "ILog" and implement "ILog" interface

public class MyLogger : ILog
    Error(object message, Exception exception)
        log.Error(exception.Message);//Now it will show message only.

then log4net.ILog log = new

it could work.

However, I want to config log4net without logging stack trace.

but I could not find any useful information.

View this message in context: http://apache-logging.6191.n7.nabble.com/how-to-make-log4net-exclude-Stack-Trace-tp53708.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Goyal, Nitin UTAS | 7 Jan 11:23 2015

Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

Hi All

I am creating a custom property in Log4Net with Visual Studio 2010 on Win7 and it is able to create everything well with the correct property. But If i try to run the same program on Win8 and Visual Studio 2013, it do create the log file but without the custom property.

I have not edited anything and same thing is working in WIn7 but not in Win8.

I don't know what is changing in both of these environments. Can anyone give hint at what to look for?

<?xml version="1.0" encoding="utf-8" ?>



    <section name="log4net"     type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />



  <appender name="CsvFileAppender" type="log4net.Appender.RollingFileAppender,log4net">

    <file type="log4net.Util.PatternString" value="C:\TSAS_DRU_Log\%property{LogName}" />

    <appendToFile value="true"/>

    <maxSizeRollBackups value="10"/>

    <maximumFileSize value="100MB"/>

    <staticLogFileName value="true"/>

    <layout type="TSAS_DRU_app.CsvPatternLayout, TSAS_DRU_app">




    <level value="DEBUG" />

    <appender-ref ref="CsvFileAppender" />





I am setting the property in the code as following which is working correctly in WIn7 but not in Win8 where I have just updated the Visual studio as version 2013 with 2010:

string LogName = "TSAS_DRU_Log_" + date + ".csv";

    log4net.GlobalContext.Properties["LogName"] = LogName;



Nitin Goyal – Technical Lead, Software – Sensors & Integrated Systems


Netra Tech Park, Old Plot No.181, New Plot No. 40, EPIP Industrial Area, Part of Sy.No.28, Kundalahalli Village, Krishnaraja Puram Hobli, Bangalore 560 066, Karnataka, India

Tel: +91 80 673 80262  Mobile: +91 9886295724  Fax: +91 80 673 80005

nitin.goyal <at> utas.utc.com    www.utcaerospacesystems.com


CONFIDENTIALITY WARNING:  This message may contain proprietary and/or privileged information of UTC Aerospace Systems and its affiliated companies.  If you are not the intended recipient, please 1) do not disclose, copy, distribute or use this message or its contents, 2) advise the sender by return e-mail, and 3) delete all copies (including all attachments) from your computer.  Your cooperation is greatly appreciated.