Details
Description
I am trying to persist logs in Oracle DB in my sample application but my second log event is throwing an exception
2022-01-19 17:48:23,022 main ERROR Unable to write to database [JdbcManager{name=SYS_LOG_DB, bufferSize=0, tableName=XYZ, columnConfigs=[{ name=APPTIER, layout=%X
{appTier}, literal=null, timestamp=false }, { name=ACTIVITY, layout=%X{activity}, literal=null, timestamp=false }, { name=LEVELS, layout=%p, literal=null, timestamp=false }, { name=STACKTRACE, layout=%X{stackTrace}, literal=null, timestamp=false }, { name=MESSAGE, layout=%m, literal=null, timestamp=false }, { name=LOG_ID, layout=null, literal=XYZ.nextVal, timestamp=false }, { name=USER_ID, layout=%X{userId}, literal=null, timestamp=false }, { name=TIMESTAMP, layout=null, literal=null, timestamp=true }], columnMappings=[]}] for appender [SYS_LOG_DB]. org.apache.logging.log4j.core.appender.AppenderLoggingException: Error writing to JDBC Manager 'JdbcManager{name=SYS_LOG_DB, bufferSize=0, tableName=XYZ, columnConfigs=[{ name=APPTIER, layout=%X{appTier}, literal=null, timestamp=false }, { name=ACTIVITY, layout=%X
{activity}, literal=null, timestamp=false }, { name=LEVELS, layout=%p, literal=null, timestamp=false }, { name=STACKTRACE, layout=%X{stackTrace}, literal=null, timestamp=false }, { name=MESSAGE, layout=%m, literal=null, timestamp=false }, { name=LOG_ID, layout=null, literal=RSMS.SYS_LOG_SEQ.nextVal, timestamp=false }, { name=USER_ID, layout=%X{userId}, literal=null, timestamp=false }, { name=TIMESTAMP, layout=null, literal=null, timestamp=true }], columnMappings=[]}': JDBC connection not available [columnConfigs=[{ name=APPTIER, layout=%X{appTier}, literal=null, timestamp=false }, { name=ACTIVITY, layout=%X{activity}, literal=null, timestamp=false }, { name=LEVELS, layout=%p, literal=null, timestamp=false }, { name=STACKTRACE, layout=%X
{stackTrace}, literal=null, timestamp=false }, { name=MESSAGE, layout=%m, literal=null, timestamp=false }, { name=USER_ID, layout=%X{userId}, literal=null, timestamp=false }, { name=TIMESTAMP, layout=null, literal=null, timestamp=true }], sqlStatement=insert into RSMS.SYS_LOG (APPTIER,ACTIVITY,LEVELS,STACKTRACE,MESSAGE,LOG_ID,USER_ID,TIMESTAMP) values (?,?,?,?,?,XYZ.nextVal,?,?), factoryData=FactoryData [connectionSource=factory{ public static java.sql.Connection appender.ConnectionFactory.getDatabaseConnection() }, tableName=RSMS.SYS_LOG, columnConfigs=[{ name=APPTIER, layout=%X{appTier}, literal=null, timestamp=false }, { name=ACTIVITY, layout=%X{activity}, literal=null, timestamp=false }, { name=LEVELS, layout=%p, literal=null, timestamp=false }, { name=STACKTRACE, layout=%X{stackTrace}, literal=null, timestamp=false }, { name=MESSAGE, layout=%m, literal=null, timestamp=false }, { name=LOG_ID, layout=null, literal=XYZ.nextVal, timestamp=false }, { name=USER_ID, layout=%X
{userId}, literal=null, timestamp=false }, { name=TIMESTAMP, layout=null, literal=null, timestamp=true }], columnMappings=[], immediateFail=false, retry=true, reconnectIntervalMillis=5000, truncateStrings=true], connection=null, statement=null, reconnector=Reconnector [latch=java.util.concurrent.CountDownLatch@b83a9be[Count = 0], shutdown=false], isBatchSupported=true, columnMetaData=null]at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.checkConnection(JdbcDatabaseManager.java:507)
at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.connectAndStart(JdbcDatabaseManager.java:610)
at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.writeThrough(JdbcDatabaseManager.java:888)
at org.apache.logging.log4j.core.appender.db.AbstractDatabaseManager.write(AbstractDatabaseManager.java:264)
at org.apache.logging.log4j.core.appender.db.AbstractDatabaseAppender.append(AbstractDatabaseAppender.java:110)
at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:161)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:134)
at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:125)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:89)
at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:542)
at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:500)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:483)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417)
at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:82)
at org.apache.logging.log4j.core.Logger.log(Logger.java:161)
at org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2205)
at org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2159)
at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2142)
at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2017)
at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1983)
at org.apache.logging.log4j.spi.AbstractLogger.log(AbstractLogger.java:1652)
at LoggerHelper.main(LoggerHelper.java:25)
2022-01-19 17:48:23,033 main ERROR An exception occurred processing Appender SYS_LOG_DB org.apache.logging.log4j.core.appender.AppenderLoggingException: Error writing to JDBC Manager 'JdbcManager{name=SYS_LOG_DB, bufferSize=0, tableName=XYZ, columnConfigs=[{ name=APPTIER, layout=%X{appTier}, literal=null, timestamp=false }, { name=ACTIVITY, layout=%X{activity}, literal=null, timestamp=false }, { name=LEVELS, layout=%p, literal=null, timestamp=false }, { name=STACKTRACE, layout=%X{stackTrace}, literal=null, timestamp=false }, { name=MESSAGE, layout=%m, literal=null, timestamp=false }, { name=LOG_ID, layout=null, literal=XYZ.nextVal, timestamp=false }, { name=USER_ID, layout=%X{userId}
, literal=null, timestamp=false }, { name=TIMESTAMP, layout=null, literal=null, timestamp=true }], columnMappings=[]}': JDBC connection not available [columnConfigs=[{ name=APPTIER, layout=%X
{appTier}, literal=null, timestamp=false }, { name=ACTIVITY, layout=%X{activity}, literal=null, timestamp=false }, { name=LEVELS, layout=%p, literal=null, timestamp=false }, { name=STACKTRACE, layout=%X{stackTrace}, literal=null, timestamp=false }, { name=MESSAGE, layout=%m, literal=null, timestamp=false }, { name=USER_ID, layout=%X{userId}, literal=null, timestamp=false }, { name=TIMESTAMP, layout=null, literal=null, timestamp=true }], sqlStatement=insert into RSMS.SYS_LOG (APPTIER,ACTIVITY,LEVELS,STACKTRACE,MESSAGE,LOG_ID,USER_ID,TIMESTAMP) values (?,?,?,?,?,XYZ.nextVal,?,?), factoryData=FactoryData [connectionSource=factory{ public static java.sql.Connection appender.ConnectionFactory.getDatabaseConnection() }, tableName=XYZ, columnConfigs=[{ name=APPTIER, layout=%X{appTier}, literal=null, timestamp=false }, { name=ACTIVITY, layout=%X
{activity}, literal=null, timestamp=false }, { name=LEVELS, layout=%p, literal=null, timestamp=false }, { name=STACKTRACE, layout=%X
{stackTrace}, literal=null, timestamp=false }, { name=MESSAGE, layout=%m, literal=null, timestamp=false }, { name=LOG_ID, layout=null, literal=XYZ.nextVal, timestamp=false }, { name=USER_ID, layout=%X
{userId}, literal=null, timestamp=false }, { name=TIMESTAMP, layout=null, literal=null, timestamp=true }], columnMappings=[], immediateFail=false, retry=true, reconnectIntervalMillis=5000, truncateStrings=true], connection=null, statement=null, reconnector=Reconnector [latch=java.util.concurrent.CountDownLatch@b83a9be[Count = 0], shutdown=false], isBatchSupported=true, columnMetaData=null]
at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.checkConnection(JdbcDatabaseManager.java:507)
at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.connectAndStart(JdbcDatabaseManager.java:610)
at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.writeThrough(JdbcDatabaseManager.java:888)
at org.apache.logging.log4j.core.appender.db.AbstractDatabaseManager.write(AbstractDatabaseManager.java:264)
at org.apache.logging.log4j.core.appender.db.AbstractDatabaseAppender.append(AbstractDatabaseAppender.java:110)
at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:161)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:134)
at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:125)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:89)
at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:542)
at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:500)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:483)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417)
at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:82)
at org.apache.logging.log4j.core.Logger.log(Logger.java:161)
at org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2205)
at org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2159)
at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2142)
at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2017)
at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1983)
at org.apache.logging.log4j.spi.AbstractLogger.log(AbstractLogger.java:1652)
at LoggerHelper.main(LoggerHelper.java:25)