PostgreSQL
 sql >> Base de Dados >  >> RDS >> PostgreSQL

DBAppender assíncrono com logback


Há uma mensagem de erro relatada pelo logback:
0:52:09,809 |-ERROR in [email protected]:75 - no applicable action for [dataSource], current pattern is [[configuration][appender][connectionSource][dataSource]]

Isso indica que o elemento aninhado não pôde ser entendido. Aqui está a parte relevante do arquivo de configuração:
<appender name="DBAppPostgreSQL" class="ch.qos.logback.classic.db.DBAppender">
  <!-- DriverManagerConnectionSource does not have a dataSource property -->
  <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
    <dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource">
      <driverClass>org.postgresql.Driver</driverClass>
      <url>jdbc:postgresql://127.0.0.1:5678/DB</url>
      <user>YYYYY</user>
      <password>XXX</password>
    </dataSource>
  </connectionSource>
  <sqlDialect class="ch.qos.logback.core.db.dialect.PostgreSQLDialect" />
  <insertHeaders>true</insertHeaders>
</appender>

ch.qos.logback.core.db.DriverManagerConnectionSource não tem um dataSource enquanto ch.qos.logback.core.db.DataSourceConnectionSource faz. Você provavelmente deseja configurar o DBAppPostgreSQL com:
<appender name="DBAppPostgreSQL" class="ch.qos.logback.classic.db.DBAppender">
  <!-- use DataSourceConnectionSource instead of DriverManagerConnectionSource -->
  <connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">
    <dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource">
      <driverClass>org.postgresql.Driver</driverClass>
      <url>jdbc:postgresql://127.0.0.1:5678/DB</url>
      <user>YYYYY</user>
      <password>XXX</password>
    </dataSource>
  </connectionSource>
  <sqlDialect class="ch.qos.logback.core.db.dialect.PostgreSQLDialect" />
  <insertHeaders>true</insertHeaders>
</appender>