Patrick Brunmayr | 26 Nov 13:35 2015

Custom Lookup - How to inject dependencies ?


I am using log4j in scala and i created a custom Lookup by extending from StrLookup. The problem i have is my
class depends on
an external configuration object. I can not pass it imlpicitly in the default constructor coz. log4
complains about not finding an
empty default constructor. An ugly solution is to make the config object accesible in the companion object
and then use it in
the instance but thats a very ugly way.

Is there any factory oder manager class where i can enumerate or access my plugin instance and call a setter ?
How can
i inject or set my dependency ?


 <at> Plugin(name = "syncer", category = "Lookup")
class SyncerLookup extends StrLookup {

  override def lookup(key: String) : String = {
     SyncerLookup.config.getOrElse[String](key, null) // BAD

  override def lookup(event: LogEvent, key: String): String = {
     SyncerLookup.config.getOrElse[String](key, null) // BAD

object SyncerLookup{
  var config:Config = _
(Continue reading)

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
(Continue reading)

jinhong lu | 24 Nov 10:35 2015

syslogAppender pattern


  I want to write log to rsyslog

when I use log4j1.x,I use this to define the pattern:

		appender.setLayout(new PatternLayout("%r " + loggerName +" [%t] %-5p %C%x - %m %C"));

How can I do the same thing in log4j2.x?

Now I get the message like this:
Nov 24 17:26:59 liaoliuqingdeMacBook-Air.local MyApp  ljh_test message 

I even can not see the level of the log. So how can I set the pattern in log4j2.x syslogPattern.

here is my configuration

<?xml version="1.0" encoding="UTF-8"?>
    <Configuration status="warn" name="MyApp" packages="com.lujinhong">
        <Syslog name="RFC5424" format="RFC5424" host="" port="514"
            protocol="UDP" appName="MyApp" includeMDC="true"
            facility="LOCAL7" enterpriseNumber="18060" newLine="true"
            messageId="Audit" mdcId="mdc" id="storm" 
                <KeyValuePair key="thread" value="%t"/>
                <KeyValuePair key="priority" value="%p"/>
                <KeyValuePair key="category" value="%c"/>
                <KeyValuePair key="exception" value="%ex"/>
(Continue reading)

Nicholas Duane | 20 Nov 02:33 2015


I'm trying to get information on the StatusLogger.  I've searched and so far the log4j docs say:

"Records events that occur in the logging system."

There are also a bunch of articles related to people having problems with the StatusLogger.  I'm just
looking to find out what it is.  It appears it's somewhat of an "internal" logger that log4j (log4j2) uses to
log internal events.  One reason I'm looking into this is because I see some code in one of our projects in
which the class is logging to the StatusLogger.  I assume we shouldn't be doing this.

Is the StatusLogger used in log4j2?  In one post I read that the "status" attribute controls the level.  Can I
set the appender for the StatusLogger?

Priya Ahuja | 20 Nov 02:01 2015

Suppressing exception trace to exception message only


I am using log4jv2.3, I am looking for a way to suppress the exception
trace and limit it to exception message only using log4j configuration?

Priya Ahuja
Matt Sicker | 18 Nov 22:35 2015

Does anyone use Log4j2 with Logstash?

Any experience with this? I was thinking of using Flume and the Flume
appender to route all my log messages to an ELK stack, but I was wondering
if there were other ways of doing this.


Matt Sicker <boards <at>>
Benjamin Jaton | 10 Nov 20:04 2015

RollingFileAppender maxDelayMillis?


I am wondering if it would make sense to have a maxDelayMillis parameter
for the RollingFileAppender (like FlumeAppender).

Use case:
You have a web server access log, you produce an HTTP request and expect to
see it (and the response) in the access logs right away-ish (or at least
control how much you have to wait).

Nicholas Duane | 10 Nov 16:22 2015

layout optional?

From reading the log4j2/log4net docs it appears adding a layout to an appender is optional.  If I don't add a
layout to an appender how does the appender generate the string for the event?  Does it simply call
toString()/ToString() on the event object?  If that's the case then if we want our event to have a specific
format by default then I guess we need to code that in toString()/ToString(), correct?

Chinh Do | 10 Nov 16:10 2015

Re: Log entries written to wrong file

The manual ( says
you can follow step (3) below to get log separation. I am not clear on what
values to set for log4jContextName and log4jConfiguration, or how exactly
to do it on WebSphere 8.5 Has anyone done this? Really appreciate any help
in advance.
Using Context Selectors

There are a few patterns for achieving the desired state of logging
separation using ContextSelectors:

   1. Place the logging jars in the container's classpath and set the
   system property "Log4jContextSelector" to
   "org.apache.logging.log4j.core.selector.BasicContextSelector". This will
   create a single LoggerContext using a single configuration that will be
   shared across all applications.
   2. Place the logging jars in the container's classpath and use the
   default ClassLoaderContextSelector. Follow the instructions to
   initialize Log4j 2 in a web application
   <>. Each
   application can be configured to share the same configuration used at the
   container or can be individually configured. If status logging is set to
   debug in the configuration there will be output from when logging is
   initialized in the container and then again in each web application.
   3. Follow the instructions to initialize Log4j 2 in a web application
   <> and set the
   system property or servlet context parameter Log4jContextSelector to
   org.apache.logging.log4j.core.selector.JndiContextSelector. This will
   cause the container to use JNDI to locate each web application's
   LoggerContext. Be sure to set the isLog4jContextSelectorNamed context
   parameter to true and also set the log4jContextName and
(Continue reading)

John Lussmyer | 10 Nov 02:53 2015

Change log level on the fly?

I'm hoping there is an easy to to just change the root level of my logger configuration on the fly.
I want to be able to provide a configuration option to my users to turn up the logging level.
I don't want to reconfigure everything, just change the level.

Is there any easy way to do that?  Or do I have to build a Configuration factory?

Confidentiality notice: This message may contain confidential information. It is intended only for the
person to whom it is addressed. If you are not that person, you should not use this message. We request that
you notify us by replying to this message, and then delete all copies including any contained in your
reply. Thank you.
Benjamin Jaton | 5 Nov 20:55 2015

Log4j2 - HTML emails pattern


I am using the SMTPAppender with a custom pattern:
  "PatternLayout" : { "pattern" : "<a href='...'>%m</a><br/>" }

But the email is sent as text.

I saw that there is a HTMLLayout but it doesn't seem to accept a pattern?

How can I produce a custom HTML message?