logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LOG4J2-1052) syslog appender hangs if it looses connection for too long
Date Mon, 06 Jul 2015 17:12:04 GMT

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

Gary Gregory updated LOG4J2-1052:
---------------------------------
    Attachment: log4j2-1052.patch

> syslog appender hangs if it looses connection for too long
> ----------------------------------------------------------
>
>                 Key: LOG4J2-1052
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1052
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.3
>         Environment:     > lsb_release -a
>     No LSB modules are available.
>     Distributor ID: Ubuntu
>     Description: Ubuntu 14.04.2 LTS
>     Release: 14.04
>     Codename: trusty
>     > java -version
>     java version "1.7.0_79"
>     OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.14.04.2)
>     OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
>            Reporter: Guillaume Turri
>            Priority: Minor
>         Attachments: log4j2-1052.patch
>
>
> * Steps to reproduce:
> ** Launch the following program
> ** Ensure the syslog receives the messages
> ** Stop the wifi of the laptop running the program, and unplug its ethernet cable (do
it on the laptop running the program; *not* on the box running the syslog)
> The code is
> {code}
> import org.apache.logging.log4j.LogManager;
> import org.apache.logging.log4j.Logger
> public class App
> {
> 	private static final Logger _logger = LogManager.getLogger("TestLogger");
> 	public static void main( String[] args ) throws Exception
> 	{
> 		int id = 0;
> 		while ( true ){
> 			String msg = "message: " + id;
> 			_logger.error(msg);
> 			id++;
> 			 Thread.sleep(10);
> 		}
> 	}
> }
> {code}
> The config is:
> {code}
> <?xml version="1.0" encoding="UTF-8"?>                                        
                                                                                         
                                                                                         
                                                
> <Configuration status="WARN">
>   <Appenders>
>     <Console name="Console" target="SYSTEM_OUT">
>       <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
>     </Console>
>     <Syslog name="my-syslog" host="my-host" port="12201" protocol="TCP" format="RFC5424"
mdcId="mdc" includeMDC="true" appName="testGTApp" newLine="true" connectTimeoutMillis="100"
immediateFail="true" reconnectionDelayMillis="3000" immediateFlush="true" />
>   </Appenders>
>   <Loggers>
>     <Root level="info">
>       <AppenderRef ref="Console" />
>       <AppenderRef ref="my-syslog"/>
>     </Root>
>   </Loggers>
> </Configuration>
> {code}
> * Expected behavior: even though the messages doesn't reach the syslog anymore, the program
continues to run forever
> * Actual behavior: after about 350 messages, the program hangs. A thread dumps shows
> {code}
> "main" prio=10 tid=0x00007fa21800a000 nid=0x2303 runnable [0x00007fa2209b6000]
>    java.lang.Thread.State: RUNNABLE
> 	at java.net.SocketOutputStream.socketWrite0(Native Method)
> 	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
> 	at java.net.SocketOutputStream.write(SocketOutputStream.java:159)
> 	at org.apache.logging.log4j.core.net.TcpSocketManager.write(TcpSocketManager.java:129)
> 	- locked <0x00000007d96ce668> (a org.apache.logging.log4j.core.net.TcpSocketManager)
> 	at org.apache.logging.log4j.core.appender.OutputStreamManager.write(OutputStreamManager.java:135)
> 	at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:110)
> 	at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:99)
> 	at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:430)
> 	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:409)
> 	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:367)
> 	at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:112)
> 	at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:727)
> 	at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:716)
> 	at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:344)
> 	at fr.test.App.main(App.java:17)
> {code} 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message