Tukesh created LOG4J2-3238:
------------------------------
Summary: Log4j 1.2 bridge API doesn't write the messages to
rsyslog in proper "PatternLayout" mentioned in log4j.properties file when
SysLogAppender is used
Key: LOG4J2-3238
URL: https://issues.apache.org/jira/browse/LOG4J2-3238
Project: Log4j 2
Issue Type: Bug
Components: API, Appenders, Core, Pattern Converters
Affects Versions: 2.16.0
Reporter: Tukesh
Attachments: log4j2.tar.gz
Log4j 1.2 bridge API doesn't write the messages to rsyslog in proper
"PatternLayout" mentioned in log4j.properties file when SysLogAppender is used .
You can see log messages are missing Conversion Patterns effect like string
"MyMain" , Data, ClassName etc.
log4j.properties file :-
{code:java}
log4j.rootLogger=DEBUG,SYSLOG
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.Threshold=DEBUG
log4j.appender.SYSLOG.syslogHost=localhost
log4j.appender.SYSLOG.port=514
log4j.appender.SYSLOG.header=true
log4j.appender.SYSLOG.Facility=LOCAL3
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
log4j.appender.SYSLOG.layout.conversionPattern=MyMain[%pid] :%t: %c %-4p %m%n
{code}
*Source code ( LoggerExample.java ) :-*
{code:java}
package test.logger;
import org.apache.log4j.Logger;
import java.io.*;
import java.sql.SQLException;
import java.util.concurrent.TimeUnit;
public class LoggerExample{
static Logger log = Logger.getLogger(LoggerExample.class.getName());
public static void main(String[] args)throws IOException,SQLException{
log.debug("log4j-shell Starting...");
while(true){
System.out.println("I'm running...");
log.debug("Test Log4j-shell this is a debug message");
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
{code}
*Sample message created :-*
{code:java}
log4j-shell Starting...
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
Test Log4j-shell this is a debug message
{code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)