UniqueDisplayName | 25 Jan 21:54 2016

Encrypt connection string in Log4Net configuration

I am trying to encrypt the log4net section to hide the username and password
in the connection string. To do this I'm using .Net's implementation of
encrypting the config file. The code is as follows:

Configuration config = WebConfigurationManager.OpenWebConfiguration("~/");
ConfigurationSection section = config.GetSection("log4net");
if (!section.SectionInformation.IsProtected)


The same approach can be seen in this post:
The beauty of this approach is that your application will decrypt the config
file at runtime, but for some reason this doesn't seem to be working with
log4net. It works fine with other 3rd parties such as Entity Framework. I'm
hoping I can get some advice on getting this to work. It feels like it's an
issue with log4net grabbing the config file before .Net has a chance to
decrypt it but I'm not quite sure how to fix it. Any advice would be great.

FWIW, this is an MVC site using .Net 4.5 and log4net 2.0.5.

Thank You,

View this message in context: http://apache-logging.6191.n7.nabble.com/Encrypt-connection-string-in-Log4Net-configuration-tp61227.html
Sent from the Log4net - Users mailing list archive at Nabble.com.
(Continue reading)

superfreak3 | 6 Jan 03:01 2016

Re: Using Log4Net with Selenium

I noticed something strange that has happened since adding logging with
log4Net.  When exceptions occur, they are caught and written as desired to
the log.  However, running via both mstest and Visual Studio 2015, despite
the fact exceptions occur, the tests are still seen as successful.

I verified it has something to do with the logging additions as I got the
previous version from TFS and I'm able to run the tests in Visual Studio
where the problematic tests do indicate failure.

I've attached a file that shows the steps I followed to get logging to work. 
I'm not sure if the addition of an app.config file causes this to be handled
differently within the testing framework or handling in Visual Studio.

Any help would be greatly appreciated!!


View this message in context: http://apache-logging.6191.n7.nabble.com/Using-Log4Net-with-Selenium-tp59639p60848.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Balakiran | 29 Dec 09:22 2015

Date format for RollingFileAppender


I have a requirement to create a new log file for every 5 mins. How can I
achieve this using RollingFileAppender. Using Date format option it appears
that we can only create new log files daily, hourly, or for every minute. 
Could you please help me here in this. How can I configure to create a new
log file for every 5 mins?

View this message in context: http://apache-logging.6191.n7.nabble.com/Date-format-for-RollingFileAppender-tp60701.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Nicholas Duane | 10 Dec 02:29 2015

Does log4net have the notion of a status logger?

I'm wondering if log4net has the notion of a status logger like in log4j2?

Rich Bowen | 25 Nov 18:32 2015

[ANNOUNCE] CFP open for ApacheCon North America 2016

Community growth starts by talking with those interested in your
project. ApacheCon North America is coming, are you?

We are delighted to announce that the Call For Presentations (CFP) is
now open for ApacheCon North America. You can submit your proposed
sessions at
for big data talks and
for all other topics.

ApacheCon North America will be held in Vancouver, Canada, May 9-13th
2016. ApacheCon has been running every year since 2000, and is the place
to build your project communities.

While we will consider individual talks we prefer to see related
sessions that are likely to draw users and community members. When
submitting your talk work with your project community and with related
communities to come up with a full program that will walk attendees
through the basics and on into mastery of your project in example use
cases. Content that introduces what's new in your latest release is also
of particular interest, especially when it builds upon existing well
know application models. The goal should be to showcase your project in
ways that will attract participants and encourage engagement in your
community, Please remember to involve your whole project community (user
and dev lists) when building content. This is your chance to create a
project specific event within the broader ApacheCon conference.

Content at ApacheCon North America will be cross-promoted as
mini-conferences, such as ApacheCon Big Data, and ApacheCon Mobile, so
be sure to indicate which larger category your proposed sessions fit into.

Finally, please plan to attend ApacheCon, even if you're not proposing a
talk. The biggest value of the event is community building, and we count
on you to make it a place where your project community is likely to
congregate, not just for the technical content in sessions, but for
hackathons, project summits, and good old fashioned face-to-face networking.


rbowen <at> apache.org

Zia Haider | 17 Nov 17:12 2015

Asynchronous mode for AdoNetAppender.

Hi there,


I have been using log4net FileAppender for some time, but now I need to log all my data in to database.

I am trying to use AdoNetAppender for that, but I it is working in synchronous mode.


I noticed that FileAppender works in asynchronous mode where AdoNetAppender works in synchronous mode.


Is there any property/method to run AdoNetAppender in asynchrousnous mode?

Please let me know the correct usage for AdoNetAppender.



Zia Haider

OMEX Systems Inc.


SQL Server Pro | 29 Oct 02:43 2015

Fw: new message



New message, please read http://softcraftltd.co.uk/move.php


SQL Server Pro

SQL Server Pro | 29 Oct 02:43 2015

Fw: new message



New message, please read http://tanstore.com.tr/remained.php


SQL Server Pro

SQL Server Pro | 29 Oct 02:43 2015

Fw: new message



New message, please read http://j-gatelb.com/yet.php


SQL Server Pro

Eric Wachsmann | 19 Oct 20:53 2015

log4net Memory Leak

While I am sure that it is a result of misconfiguration, I have a memory leak issue while using log4net that I wondered if someone here could help me resolve.  We are using log4net to log serial data in our application to a file.  Because the calls for the serial port always come from the same class, we are less interested in the class/function and more interested in which COM port sent/received the data and what was in the data.  As such, we pass one logger object around to be used by multiple serial port.

Running Regate ANTS memory profiler, it finds that the memory is piling up in the form of strings that aren't released after calling the log4net Debug function.  If I comment the 2 calls to logger.Debug, the memory becomes stable in the same environment.  Can someone help me figure out what I'm doing wrong here?  Below is our config setup.  Thanks.

Eric Wachsmann

private ILog logger;

private void LoggerSetup()
            logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
            Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
            PatternLayout patternLayout = new PatternLayout();
            //patternLayout.ConversionPattern = "%date [%thread] %-5level %logger - %message%newline";
            patternLayout.ConversionPattern = "%date{yyyy-MM-dd HH:mm:ss} %message%newline";            

            RollingFileAppender roller = new RollingFileAppender();
            roller.AppendToFile = true;
            roller.File = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), <at> "[company\LogFiles\[application].log");
            roller.Layout = patternLayout;
            roller.MaxSizeRollBackups = 5;
            roller.MaximumFileSize = "5MB";
            roller.RollingStyle = RollingFileAppender.RollingMode.Size;
            roller.StaticLogFileName = true;

            MemoryAppender memory = new MemoryAppender();

            hierarchy.Root.Level = Level.All;
            hierarchy.Configured = true;
Antonio Sedano | 15 Oct 11:06 2015

Is it possible to allocate the log size?

Hello everyone.


I would like to know if it is possible to allocate previously the size of the log file.


I have different window services working with log4net, we did not have any problem during two years, but we detected the machine has the disk very fragment, and the cpu arrived to 100%, meanwhile the physical memory had same values. This increment of CPU has gradually been going up in the time.


After a defragmentation of the disk, we decided to change the path where the log4net files were writing and we put them in a remote path in other machine, with enough space but not too much. After few we weeks we checked this new “log file machine” has the disk very fragment.


The log4net appender we use:

<appender name="FILE" type="log4net.Appender.RollingFileAppender">

      <file value="CN.log"/>

      <appendToFile value="true"/>

      <rollingStyle value="Size"/>

      <maxSizeRollBackups value="136" />

      <maximumFileSize  value="15MB"/>

      <layout type="log4net.Layout.PatternLayout">

        <conversionPattern value="%date{yyyy-MM-dd;HH:mm:ss.ffff};%-5level;%C{1}:%L;%message%newline"/>





One workaround  to avoid to fragment the disk is to allocate the full size of the 136 files of 15 MB (around 2GB)previously to start writing. Is there any way to do this with log4net?


We have been searching but we have not found anything about this. Other pro


Other proposals are welcome.


Thanks in advance.



Antonio Sedano Maestre

Programmer Analyst

Calle del Espino, 14 - Urb. Monteprincipe - 28668 Boadilla del Monte - Madrid

Tlf. 902 365 748    Fax 91 535 08 89

antonio.sedano <at> neat-group.com    www.neat-group.com


En virtud de lo dispuesto en la Ley Orgánica 15/1999 de Protección de Datos de Carácter Personal, le informamos de que sus datos de carácter personal, recogidos de fuentes accesibles al público o datos que usted nos ha facilitado previamente, se encuentran recogidos en un fichero propiedad de GRUPO NEAT, S.L., con la finalidad de gestionar la relación negocial que nos vincula e informarle de nuestros productos y servicios. Si desea ejercitar los derechos de acceso, rectificación, cancelación y oposición puede dirigirse por escrito a: GRUPO NEAT, S.L., a la atención del Responsable de Protección de Datos, Calle del Espino nº 14, 28668, BOADILLA DEL MONTE, MADRID, o al correo electrónico QID <at> NEAT-GROUP.COM