You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Matt Sicker (JIRA)" <ji...@apache.org> on 2014/02/05 23:26:09 UTC

[jira] [Commented] (LOG4J2-457) JDBCAppender does not release JDBC connections to the connection pool when WAR/EAR is stopped

    [ https://issues.apache.org/jira/browse/LOG4J2-457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13892654#comment-13892654 ] 

Matt Sicker commented on LOG4J2-457:
------------------------------------

In general, the JDBC appender classes need to use a more robust method to managing connections. It's annoying to use with DriverManager, for instance, since we'd have to do manual connection pooling which is rather error prone. Using DataSource or JNDI both give you the connection pooling for free practically, but DriverManager is pretty low level.

> JDBCAppender does not release JDBC connections to the connection pool when WAR/EAR is stopped
> ---------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-457
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-457
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.0-beta9
>         Environment: JBOSS application server, PostgreSQL database
>            Reporter: Tihomir Meščić
>
> We use log4j 2 for logging inside our J2EE app (packaged as EAR, log4j JARs are bundled inside). The app is deployed on JBOSS EAP 6.1 app server. We are using the JDBCAppender for logging to a PostgreSQL database, and the appender is configured to use a DataSource for fetching connections. The appender is configured as follows:
>     <JDBC name="jdbcAppender" tableName="log_entries">
>       <DataSource jndiName="java:jboss/datasources/XyzDS" />
>       <Column name="log_entries_message" isUnicode="false" pattern="%message" />
>       <Column name="log_entries_type" literal="0" />
>       .....
> The problem is: after the EAR is stopped (undeployed) log4j is not releasing the JDBC connection back to the connection pool, and after we stop/start the application a couple of times, our server becomes useless because there are no more free connections in the connection pool. I've looked at the thread dump of the server and there are a lot of threads like this:
> org.apache.logging.log4j.core.LoggerContext$ShutdownThread @ 0xbe447138



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

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