David KOCH | 27 Jul 12:17 2015

Send StatusLogger output to Syslog appender


How do I configure log4j2 to send StatusLogger output to a Syslog appender?

Our application runs on several instances and logs to a remote instance for
centralised logging, however status logging only appears in the logs on
each instance.

Thank you,

Benjamin Jaton | 24 Jul 21:17 2015

File monitor - reload DefaultRolloverStrategy


I am using this configuration :

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG"* monitorInterval="2"*>
    <RollingFile name="RollingFile" fileName="/tmp/test/app.log"
        <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
        <SizeBasedTriggeringPolicy size="100KB"/>
      *<DefaultRolloverStrategy max="5"/>*
    <Root level="info" includeLocation="false">
      <AppenderRef ref="RollingFile"/>

I am changing the DefaultRolloverStrategy "max" attribute from 5 to 10.
I can see the reloading take place from the StatusLogger (full log

*DEBUG Starting configuration
(Continue reading)

Mike Guo | 23 Jul 12:36 2015

log4j2 initialize Log4j failed

Hi, all.

I tried to use log4j2 under tomato 8.x.  

when I deploy my application to tomcat 8.x, the compile success and install deploy success. 
but the application can’t be start, I checked the tomcat log:

371 ERROR StatusLogger LogManager returned an instance of
org.apache.logging.slf4j.SLF4JLoggerContextFactory which do     es not implement
org.apache.logging.log4j.core.impl.Log4jContextFactory. Unable to initialize Log4j.
 372 23-Jul-2015 18:24:38.008 SEVERE [http-nio-8080-exec-26]
org.apache.catalina.core.StandardContext.startInternal On     e or more Filters failed to start. Full
details will be found in the appropriate container log file
 373 23-Jul-2015 18:24:38.009 SEVERE [http-nio-8080-exec-26]
org.apache.catalina.core.StandardContext.startInternal Co     ntext [/51ershouwang] startup failed
due to previous errors
 374 23-Jul-2015 18:24:38.064 INFO [http-nio-8080-exec-26]
org.apache.catalina.startup.HostConfig.deployWAR Deployment      of web application archive
/usr/local/tomcat8024/webapps/51ershouwang.war has finished in 2,408 ms

would you please help me take a look about this issue?

thanks so much


kusmanjali | 22 Jul 08:01 2015

Log4J2 NoSQL query

1. Most of the logging frame works use a log forwarder + queue
mechanism(Logstash, Fluectd) to store logs into database. What is the
advantage of using this over using Log4j NoSQL appenders to write directly
to the database.

2. Any material/link to get more insight into how log4j2 handles the
database connection and failover. And how we can scale this architecture to
store logs from multiple servers into a single database.

Our idea is to build a central logging system just by using Log4 and doing
away with forwarders and queues.


with regards
Kusmanjali Jenamoni
Benjamin Jaton | 22 Jul 00:45 2015

JDBC Appender : how to have the pattern produce NULL?


I am using the JDBCAppender:

  "type" : "Jdbc",
  "name" : "MyDatabaseAppender",
  "tableName" : "LOGS",
  "ignoreExceptions" : "false",
  "ConnectionFactory" : {
    "class" : "test.ConnectionFactory",
    "method" : "getDatabaseAppenderDataSource"
  "Column" : [
     { "name" : "ID", "pattern" : "%X{ID}", "isUnicode" : "false" },
     { "name" : "NUM", "pattern" : "%X{NUM}", "isUnicode" : "false" }

As you can see, I am using the ThreadContext to pass the variables.

ThreadContext.put("ID", id++);
ThreadContext.put("NUM", "41");

The NUM column is of type BIGINT, and is nullable.

I am trying to set it to NULL with:
  ThreadContext.put("NUM", "NULL");
  ThreadContext.put("NUM", null);
(Continue reading)

Gary Gregory | 19 Jul 20:26 2015

Re: Print the LoggerContext name

And you have your web app configured per
https://logging.apache.org/log4j/2.x/manual/webapp.html ?


On Sat, Jul 18, 2015 at 8:30 PM, Clément Guillaume <cguillaume <at> hotpads.com>

> Yes, I trying to print the servletContext.servletContextName using the
> WebLookup (${web:servletContextName}). But it doesn't work for now.
> On Sat, Jul 18, 2015 at 8:26 PM, Gary Gregory <garydgregory <at> gmail.com>
> wrote:
> > So you are using servletContextName?
> >
> > Gary
> >
> > On Sat, Jul 18, 2015 at 8:19 PM, Clément Guillaume <
> cguillaume <at> hotpads.com
> > >
> > wrote:
> >
> > > Hi, thank you for your answers,
> > >
> > > My primary goal is to is to print the WebApplication name. I found here
> > > <http://logging.apache.org/log4j/2.x/manual/webapp.html#ContextParams>
> > > that
> > > by default the LoggerContext name is the WebApplication name.
> > >
(Continue reading)

Benjamin Jaton | 16 Jul 18:25 2015

SNMP Appender


Do you know if there is any implementation of an SNMP appender for log4j2?

I found this http://code.google.com/p/log4j-snmp-trap-appender/ but I think
it is exclusively for log4j1.

Mikael Ståldal | 16 Jul 10:49 2015

FATAL Unable to register shutdown hook because JVM is shutting down.

I sometimes get the message:
FATAL Unable to register shutdown hook because JVM is shutting down.

This happens in a short running batch job.

Can it be so that Log4j did not have time to initialize fully before
shutting down? What can be done about it?

Log4j 2.3.


[image: MagineTV]

 *Mikael Ståldal*
Senior backend developer

 *Magine TV*
 mikael.staldal <at> magine.com
 Regeringsgatan 25  | 111 53 Stockholm, Sweden  |   www.magine.com

 Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
Saurabh Jain | 16 Jul 06:05 2015

Log4j2 over log4j

Hi list

We want to migrate to log4j2 from log4j
But I need to convince the client by showcasing its advantages.
Do we have some portal or link where I can get the advantages sort of
comparison thing.

Clément Guillaume | 14 Jul 05:24 2015

Print the LoggerContext name

Is it possible to print the LoggerContext name in the output?

Hans Meiser | 8 Jul 14:37 2015

Release 2.4 due to JBoss 6.2.4 EAP bug

Dear log4j-members,

we are using log4j at our JBoss 6.2.4 EAP. Unfortunatelly JBoss has an bug,
which causes an ugly exception when using log4j-web-2.3.jar.
If any comments in log4js javax.servlet.ServletContainerInitializer are
removed it is working fine again.

Of course, it is not your fault but a JBos problem, nevertheless the only
we to come around this problem ist to replace the
javax.servlet.ServletContainerInitializer file by an equivalent file
without comments.

We are doing this by hand so far and so we are desperately looking for
log4j-web-2.4.jar going to be released. Do you already know any release

Thanks a lot,