0

I am using Wildfly 8 for my deployment. Our application uses JDBC to access database. The database resource management from Java code is not proper, like when a connection is closed, many of its associated statements or resultsets are not closed. So when I am closing a connection, the following WARN is thrown by the server:

21:52:35,702 WARN  [org.jboss.jca.adapters.jdbc.WrappedConnection] (EJB default - 1) Closing a statement you left open, please do your own housekeeping: java.lang.Throwable: STACKTRACE
    at org.jboss.jca.adapters.jdbc.WrappedConnection.registerStatement(WrappedConnection.java:1677)
    at org.jboss.jca.adapters.jdbc.WrappedStatement.<init>(WrappedStatement.java:105)
    at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.<init>(WrappedPreparedStatement.java:69)
    at org.jboss.jca.adapters.jdbc.jdk6.WrappedPreparedStatementJDK6.<init>(WrappedPreparedStatementJDK6.java:52)
    at org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6.wrapPreparedStatement(WrappedConnectionJDK6.java:79)
    at org.jboss.jca.adapters.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:405)

How to suppress such warning messages such that they do not appear in server.log of Wildfly?

James Z
  • 12,209
  • 10
  • 24
  • 44
Anirban
  • 925
  • 4
  • 24
  • 54

2 Answers2

2

You should fix your code, not just suppress the log that is telling you that you have written bad code

Will Tatam
  • 566
  • 3
  • 10
1

Assuming you're using the default configuration, then $JBOSS_HOME/standalone/configuration/standalone.xml is an XML file which contains the logging configuration for your server. The XPATH /jboss:server/jboss:profile/logging:subsystem will take you to an element which contains a number of logger elements, each with a category and a level. The category is the name of the logger being configured, for example org.jboss.jca.adapters.jdbc.WrappedConnection and the level name is the threshold being set on that logger. If you set the logging level to ERROR, like the following configuration, then any WARN logs will be suppressed.

<logger category="org.jboss.jca.adapters.jdbc.WrappedConnection">
    <level name="ERROR"/>
</logger>

It's still better to actually resolve the erroneous code, but this will do what you've asked.

dew_the_fifth
  • 131
  • 1
  • 9