J.Hoffmann | 25 Nov 17:49 2014

What happened to Telnet-Appender in log4j2?

Hi everybody,

We have used the Telnet-Appender with log4j.
When migrating to log4j2 I have seen, that it seem to doesn't exist anymore
in log4j2?
I was even not able to find any information at Apache. What happend to
Telnet Appender?

Thanks for reply.

Stephan Druskat | 24 Nov 10:58 2014

Using log4j2 2.1 over slf4j 1.7.7 in Eclipse RCP

Dear List,

I'm developing an Eclipse RCP based on Eclipse 3.7.2 (Indigo).

I'd like to use log4j2 (2.1) over slf4j 1.7.7, but I'm having trouble
getting it to work. I have done the following to add log4j2 and slf4j to
my application.

- I've built a p2 repo including slf4j.api_1.7.7.jar,

- I've consumed this p2 repo in my target platform + added it to the
parent POM of my project.

- I've added all 4 plugins to my Eclipse plugin project as dependencies

- I've created a file log4j2.xml in the project root in my Eclipse
plugin. Content below.

- I've added a private static final Logger logger =
LoggerFactory.getLogger(MyClass.class) field to MyClass

- In MyClass, I've called logger.error("Hi from logger").

However, when I run my application, I'm getting an error message: ERROR
StatusLogger Log4j2 could not find a logging implementation. Please add
log4j-core to the classpath. Using SimpleLogger to log to the console...
(Continue reading)

Dave Westerman | 21 Nov 17:18 2014

Commit errors using log4j2 JDBCAppender with DB2 in WebSphere Liberty Profile

I am trying to use the log4j2 JDBCAppender in my JEE application in 
WebSphere Liberty Profile with a DB2 DataSource. I'm wondering if I have a 
configuration error, because I am seeing the following error in my log:

Caused by: java.sql.SQLException: DSRA9350E: Operation Connection.commit 
is not allowed during a global transaction. 



    ... 84 more 
2014-11-20 20:23:33,663 ERROR An exception occurred processing Appender 
org.apache.logging.log4j.core.appender.AppenderLoggingException: Failed to 
commit transaction logging event or flushing buffer. 

Here is my log4j config data:

    <JDBC name="OneViewPrimaryLogDatabase" tableName="IONEVIEW.LOG"> 
        <DataSource jndiName="jdbc/OneViewPrimaryLogDataSource" /> 
        <Column name="LOGDATE" isEventTimestamp="true" /> 
        <Column name="LOGGER" pattern="%logger" isUnicode="false" /> 
        <Column name="LOGLEVEL" pattern="%level" isUnicode="false" /> 
        <Column name="MESSAGE" pattern="%message" isUnicode="false" /> 

And here is my DataSource config from WLP:
(Continue reading)

Tomek Sztelak | 21 Nov 10:34 2014

Log4j 2.1 and compilation memory usage


We just updated log4j from 2.0-beta9 to 2.1 and memory consumtion during
compilation of  our application increased about 300-400MB causing
OutOfMemory on same machines.
Any idea what can cause this?

Best regards.
youri flement | 12 Nov 12:01 2014

Log to REST service


I was wondering if it is possible to configure Log4j to send my logs to a
REST service?
I have taken a look at the SocketAppender but I don't think that's what I'm
looking for.

Kind regards,
David KOCH | 10 Nov 17:32 2014

Unable to create detached markers via log4j-slf4j-impl 2.1.


I am unable to create detached versions of existing markers when using
log4j2 through the slf4j facade - log4j2 version is 2.1.


import org.slf4j.Marker;
import org.slf4j.MarkerFactory;

public class TestMarker {

    public static void main(String[] args) {
       Marker markerA = MarkerFactory.getMarker("testA");
       Marker markerB = MarkerFactory.getMarker("testB");
       Marker markerANew = MarkerFactory.getDetachedMarker("testA");
       // Iteration below will fail if this line is uncommented.
       //System.out.println("Removing reference from detached markerA: " +

       System.out.println("Has reference marker A: " +
       System.out.println("Has reference detached marker A: " +

       Iterator<Marker> mRef = markerA.iterator();
       while (mRef.hasNext()) {
(Continue reading)

joey.lv | 10 Nov 08:16 2014

[log4j2_2.1] How to write different log-messages to different log-files?

I want to write the 'trace' and 'debug' messages to debug.log, 'info' messages to info.log, and
'warn','error','fafal' messages to error.log

Here is a sample java code,
package com.r7oad.udsp.common.cache.test;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Log4j2Test {
    private static final Logger logger = LogManager.getLogger(Log4j2Test.class);
    public static void main(String[] args){
        logger.trace("Hello world - trace log");
        logger.debug("Hello world - debug log");
        logger.info("Hello world - info log");
        logger.warn("Hello world - warn log");
        logger.error("Hello world - error log");
        logger.fatal("Hello world - fatal log");

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

<configuration debug="off" monitorInterval="1800">
        <Property name="log-path">d://logs</Property>

(Continue reading)

Andrew Munn | 10 Nov 01:29 2014

Custom appender needed to HTTP POST log msgs?

I use the Slack chat application and I can post msgs to it using http POST 
like this:

curl -X POST --data-urlencode 'payload={"channel": "#general", "username": 
"webhookbot", "text": "This is the errort.", "icon_emoji": ":ghost:"}' 

Is there a way to configure an off-the-shelf appender to HTTP POST log 
messsages like this directly?  Or do I need to create a custom appender?  
I know I could just log to a file, tail the file, and piece together that 
curl command in a shell script each time the file is appended to. 

Alexey Zavizionov | 5 Nov 20:03 2014

How to print timestamp on each log line of a stack trace?

Here is the output, when an application is throwing an exception, logging
it to log, including its stack trace.

E 1105-2042:17,349 c.e.TestLog error-message [main]
java.lang.Exception: SomeError
  at com.examples.TestLog.main(TestLog.java:15)

Want to see the timestamp "E 1105-2042:17,349" on each log line.
How can I do? Is it possible with configuration file?

public class TestLog {
private static final Logger LOGGER = LoggerFactory.getLogger(TestLog.class);
public static void main(String[] args) {
LOGGER.error("error-", new Exception("SomeError"));

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
        <RollingRandomAccessFile name="server" fileName="server.log"
filePattern="server-%d-%i.log.zip" immediateFlush="false">
            <ThresholdFilter level="DEBUG" />
                <pattern>%level{length=1} %date{MMdd-HHmm:ss,SSS}
(Continue reading)

Paul Benedict | 3 Nov 22:38 2014

Re: log4j2.xml in EAR

Well I have the classes loading now. I still can't find my log4j2.xml but
at least the "api" and "core" libraries are being exposed to my application.

Okay, so to test this, make sure your "api" and "core" libraries are set to
"provided" scope in Maven. You don't want them already bundled; we want to
use the single copy installed in Wildfly.

My module file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="org.apache.log4j2">
        <resource-root path="log4j-api-2.1.jar"/>
        <resource-root path="log4j-core-2.1.jar"/>
        <module name="javaee.api" />

It seems "core" is dependent upon JMX and other EE APIs; so I had to
include a dependency. We can probably figure out which EE modules are
really needed (and slim down), but I don't have the time to prune -- so I
included everything EE.

Next was my jboss-deployment-structure.xml. I have to export the log4j
libraries so my EJB modules can see them:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
(Continue reading)

Shawn Heisey | 2 Nov 18:13 2014

RollingFileAppender appears to be losing log entries

I asked this question on the solr-user mailing list first, but got no response.  It's a major party weekend,
so I'm not really surprised, and I think this is probably a problem with log4j, not Solr.

There appear to be large blocks of time missing in my solr logfiles created with slf4j->log4j and rotated
using the log4j config:

End of solr.log.1: INFO  - 2014-10-31 12:52:25.073;
Start of solr.log: INFO  - 2014-11-01 02:27:27.404;

End of solr.log.2: INFO  - 2014-10-29 06:30:32.661;
Start of solr.log.1: INFO  - 2014-10-30 07:01:34.241;

There is about 2.5 hours missing for the first pair, and over 24 hours missing for the second.  I have not
checked all the logfiles to see if they are missing time.

Queries happen at a fairly constant low level at almost all hours, and updates happen once a minute, so I know
for sure that there is activity during the missing blocks of time.  I had a weird problem during the time that
is missing, so I have no way to determine what happened.

This is the log4j configuration that I'm using:


These are the logging jars that I have in jetty's lib/ext:

-rw-r--r-- 1 ncindex ncindex  16515 Apr 11  2014 jcl-over-slf4j-1.7.6.jar
-rw-r--r-- 1 ncindex ncindex   4959 Apr 11  2014 jul-to-slf4j-1.7.6.jar
-rw-r--r-- 1 ncindex ncindex 489883 Apr 11  2014 log4j-1.2.17.jar
-rw-r--r-- 1 ncindex ncindex  28688 Apr 11  2014 slf4j-api-1.7.6.jar
-rw-r--r-- 1 ncindex ncindex   8869 Apr 11  2014 slf4j-log4j12-1.7.6.jar
(Continue reading)