Commons Dbcp
  1. Commons Dbcp
  2. DBCP-194

BasicDataSource.setLogWriter should not do createDataSource

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.3
    • Labels:
      None

      Description

      The code for setLogWriter is:

      public void setLogWriter(PrintWriter logWriter) throws SQLException

      { createDataSource().setLogWriter(logWriter); this.logWriter = logWriter; }

      This means that before a custom log writer is set a datasource is created. Any logging happening while creating the datasource is directed to stdout / stderr.

      I think the purpose of setting a log writer is to prevent this, at least that is what I am trying to achieve.

        Activity

        Hide
        Kees de Kooter added a comment -

        Unfortunately this does not solve my problem. I want to get rid of the text "AbandonedObjectPool is used" that is printed to stdout each time I start the pool.

        The root cause is in AbandonedObjectPool itself, in the constructor:

        System.out.println("AbandonedObjectPool is used (" + this + ")");
        System.out.println(" LogAbandoned: " + config.getLogAbandoned());
        System.out.println(" RemoveAbandoned: " + config.getRemoveAbandoned());
        System.out.println(" RemoveAbandonedTimeout: " + config.getRemoveAbandonedTimeout());

        This should at least be written to a configurable (Print)Writer. And preferably to a configurable logger of course.

        Show
        Kees de Kooter added a comment - Unfortunately this does not solve my problem. I want to get rid of the text "AbandonedObjectPool is used" that is printed to stdout each time I start the pool. The root cause is in AbandonedObjectPool itself, in the constructor: System.out.println("AbandonedObjectPool is used (" + this + ")"); System.out.println(" LogAbandoned: " + config.getLogAbandoned()); System.out.println(" RemoveAbandoned: " + config.getRemoveAbandoned()); System.out.println(" RemoveAbandonedTimeout: " + config.getRemoveAbandonedTimeout()); This should at least be written to a configurable (Print)Writer. And preferably to a configurable logger of course.
        Hide
        Kees de Kooter added a comment -

        System.out is also used in AbandonedTrace

        Show
        Kees de Kooter added a comment - System.out is also used in AbandonedTrace
        Hide
        Kees de Kooter added a comment -

        Patched AbandonedObjectPool

        Show
        Kees de Kooter added a comment - Patched AbandonedObjectPool
        Hide
        Phil Steitz added a comment -

        This will be part of the logging cleanup in 1.3

        Show
        Phil Steitz added a comment - This will be part of the logging cleanup in 1.3
        Hide
        Dain Sundstrom added a comment -

        Fixed some time ago.

        Show
        Dain Sundstrom added a comment - Fixed some time ago.

          People

          • Assignee:
            Unassigned
            Reporter:
            Kees de Kooter
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development