Logback

DBAppender

The DDL script can be found inside source code logback-classic\src\main\java\ch\qos\logback\classic\db\<db>.sql.

DBAppender can be defined as below for JNDIConnectionSource

<appender name="databaseAppender" class="ch.qos.logback.classic.db.DBAppender">
  <connectionSource class="ch.qos.logback.core.db.JNDIConnectionSource">
    <jndiLocation>jdbc/logging</jndiLocation>
  </connectionSource>
</appender>

RollingFileAppender

<appender name="rollingFileAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
  <file>/Users/dev/Desktop/logging/logback.log</file>

  <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
    <!-- rollover daily -->
    <fileNamePattern>/Users/dev/Desktop/logging/logback.%d{yyyy-MM-dd}.%i.log</fileNamePattern>

    <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB -->
    <maxFileSize>100MB</maxFileSize>    
    <maxHistory>60</maxHistory>
    <totalSizeCap>20GB</totalSizeCap>
  </rollingPolicy>

  <encoder>
      <pattern>%d{HH:mm:ss.SSS} >> %-3relative [%thread] %-5level	%logger{25} - %msg%n</pattern>
  </encoder>
</appender>

DBAppender with JNDI

<appender name="databaseAppender" class="ch.qos.logback.classic.db.DBAppender">
  <connectionSource class="ch.qos.logback.core.db.JNDIConnectionSource">
    <jndiLocation>jdbc/pinger</jndiLocation>
  </connectionSource>
</appender>