Mariano Gonzalez | 30 Jul 21:30 2014



I'm configuring a RollingFileAppender programatically, using a
TimeBasedTriggeringPolicy in tandem with a DefaultRooloverStrategy. So far
so good, but is there a way to provide a RolloeverStrategy which renames
the files but never deletes them?

Mike Calmus | 29 Jul 14:47 2014

problems with web app and JndiContextSelector

I am having problems moving our web app over to Log4j 2.0 using JNDI
lookups. I followed the configuration documentation and am not getting any
errors, but nothing is being logged to my configured appenders. Weirdly, if
I remove the JNDI env-entry configuration from web.xml logging seems to
work, albeit with the expected NameNotFoundException in the server output.

One possibly relevant configuration difference is that we load the log4j
jar files as part of server startup so each app doesn't have to load them.

Any ideas? What configuration can I provide to help troubleshoot?

chouaffe frannck-edmond | 29 Jul 10:18 2014


Hi Guys,

I have been struggling to get my log4j.xml file working as intended. 
I expect the log files rollover once the 100KB size has been reached. However the log4j does write in
multiple log file simultaniously.

How can this be? I would expect log4j to write to a single until the maxfilesize is reached. The file will then
be backed up and so on.

I really need some inputs of yours

Edmond Chouaffé 
Liav Elias | 29 Jul 07:29 2014

RollingFile appender in tomcat 7 with log4j2


I am trying to configure RollingFile appender in tomcat 7 with log4j2 with 5 log files.
I am using in the filePattern the ${sys:catalina.base} but in the log I see the error:

ERROR Unable to create directory C:\eclipse\    omcat7\logs

The same happen if I run tomcat from outside the eclipse (path is different but still there is space in the path).
When I use a path which is hardcoded (C:/temp) it works.
I also tried it with catalina.base and I get the same result.
The interesting part is that the first log file (without a number) is created ok under tomcat/logs - which
means it succeeds to map the filename attribute to a real path
Here is the full appender I use:

<RollingFile name="MyLogFile" fileName="${sys:catalina.home}/logs/MyLog.log"
        <Pattern>%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p %c{3} %x - %m%n</Pattern>
        <SizeBasedTriggeringPolicy size="10KB"/>
      <DefaultRolloverStrategy max="5" min="1"/>

Thanks for the help,
This email and any files transmitted with it are confidential material. They are intended solely for the
use of the designated individual or entity to whom they are addressed. If the reader of this message is not
the intended recipient, you are hereby notified that any dissemination, use, distribution or copying of
(Continue reading)

jfloviou | 24 Jul 11:59 2014

Re: Flume Appender

Hi all,

I'm digging out this Thread from December 2012 as i would like to get fresh
thoughts on these questions.

Before reading the discussion i was also hesitating between a Flume Embedded
Agent or a Flume Appender after and Asynch Appender.
Ralph performance output were very interesting but i feel like he compared
Embedded agent vs Flume Appender without Asynch, with of course great
advantage to the Embedded Agent.

=> Did anybody get to the same question and has fresh thoughts on this topic

Best regards


View this message in context:
Sent from the Log4j - Users mailing list archive at
David KOCH | 24 Jul 11:25 2014

Routing based on marker value

Note: Re-send, I got a mail error the first time round. Excuse if


I want to dynamically route to different collections based on the
marker I send with a message in a marker, String
string) call. I have no problem doing the equivalent with the thread
context by using ${ctx:key}. However, how can I accomplish the same
based on the marker value, say by using ${marker}?

I wrote a custom marker context which I include below, however it
doesn't really make sense since there are no keys in the marker, and it does not work either.


Kari Arvonen | 23 Jul 17:36 2014

How to get Log4j2, Tomcat and Chainsaw work together?


- Apache Log4j2 2.0 release version
- Apache Tomcat 7.0.54
- Apache Chainsaw 2.1 snapshot (
- Oracle Java SE 7 u60 JDK

I have tried to get the XMLLayout to work with Log4j2 assuming it is the
best format for Chainsaw. What is preferred way to do this?

In any case current log4j2.xml placed in one of the Webapps WEB-INF\classes
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="ALL">
    <File name="XmlFile" fileName="logs/0000Atest.log"
immediateFlush="true" append="true">
      <XMLLayout complete="true" charset="UTF-8" compact="false"/>

    <AsyncRoot level="ALL" includeLocation="false">
      <AppenderRef ref="XmlFile"/>

Configuration is read properly. Where I have been struggling is which jars
(Continue reading)

David KOCH | 23 Jul 11:40 2014

Typed log messages


When I log I do: object_instance -> JSON -> string,
logger.log(<my_json_string_from_object>) in the application only to do the
de-serialisation in each of my custom appenders' append(LogEvent) methods,
followed by appender-specific processing on the de-serialised object.

I would like to know how can I make the serialisation/de-serialisation
procedure less "manual", like I just call logger.log(<my_Object>) and the
LogEvent processed inside the appender's append method contains the object
inside (<my_class>) LogEvent.getMessage().


Merten Schumann | 23 Jul 08:32 2014

Logger.setLevel() not supported in 2.0?


from "Converting to the Log4j 2 API":
Calls to org.apache.log4j.Logger.setLevel() or similar methods are not supported in the API.
Applications should remove these.

Could imagine the reason, checking getLevel() is final, so it's quick.
But, when you have in your program your good old fixed static Logger log, it's often helpful to toggle its
logger level at runtime, when the method that should be investigated is reached in the code or in the
debugger ... enable DEBUG output and disable it again ...

Am I missing something? Nobody else missing this feature? :-)


Mariano Gonzalez | 22 Jul 17:18 2014

Disruptor 3.2.x


According to the manual, async loggers require Disruptor 3.0. However, the
3.2.x series of disruptor is available. Have you tried this version? Are
you recommending 3.0 because you found issues with other versions or is it
just in your TODO list to give 3.2 a ride and/or update the manual?

VolkerKopetzky | 22 Jul 13:29 2014

How to set email message header with SMTPAppender and PatternLayout


I'm using log4j 1.2.15.

The Appender used for email is:

<appender name="ErrorNotifier" class="">
<param name="Threshold" value="ERROR"/>
<param name="To" value="mail <at>"/>
<param name="From" value="mail <at>"/>
<param name="SMTPHost" value=""/>
<param name="BufferSize" value="100"/>
<param name="Subject" value="New Error!"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d{ISO8601} - %m%n"/>

This works nicely, yet I would like to add additional email message headers to the message.

Is that possible?

If so, how can I add, for example this header to the email send by the Appender:
X-System-Postid: post12345
X-System-Forumid: forum12345

Many thanx in advance!!

Beste Grüße, kind regards,
Volker Kopetzky
vzk Beratung
Germany & Thailand

phone    +49.6809.2163.30
phone    +
skype    volker.kopetzky
email    vk <at>