You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Volkan Yazici (Jira)" <ji...@apache.org> on 2021/12/20 21:56:00 UTC

[jira] [Closed] (LOG4J2-3238) Log4j 1.2 bridge API doesn't write the messages to rsyslog in proper "PatternLayout" mentioned in log4j.properties file when SysLogAppender is used

     [ https://issues.apache.org/jira/browse/LOG4J2-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Volkan Yazici closed LOG4J2-3238.
---------------------------------
    Resolution: Not A Problem

> 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
>         Environment: *JDK .1.8 :-*
> copy-jdk-configs-3.3-10.el7_5.noarch
> java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.i686
> java-1.8.0-openjdk-devel-1.8.0.242.b08-0.el7_7.i686
> java-1.8.0-openjdk-headless-1.8.0.242.b08-0.el7_7.i686
> *JVM arguments :-* 
>  *-Dlog4j1.compatibility=true* 
>  
> *Jar used :-*
> log4j-1.2-api-2.16.0.jar  
> log4j-api-2.16.0.jar  
> log4j-core-2.16.0.jar
>            Reporter: Tukesh
>            Priority: Blocker
>         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)