Search in sources :

Example 1 with InvalidAppenderConfigurationException

use of com.axway.ats.log.autodb.exceptions.InvalidAppenderConfigurationException in project ats-framework by Axway.

the class AbstractDbAppender method activateOptions.

/* (non-Javadoc)
     * @see org.apache.log4j.AppenderSkeleton#activateOptions()
     */
@Override
public void activateOptions() {
    //check whether the configuration is valid first
    try {
        appenderConfig.validate();
    } catch (InvalidAppenderConfigurationException iace) {
        throw new DbAppenederException(iace);
    }
    //set the threshold if there is such
    appenderConfig.setLoggingThreshold(getThreshold());
    //the logging queue
    queue = new ArrayBlockingQueue<LogEventRequest>(getMaxNumberLogEvents());
    // enable batch mode at ATS Agent side only
    boolean isWorkingAtAgentSide = this instanceof PassiveDbAppender;
    boolean isBatchMode = false;
    if (isWorkingAtAgentSide) {
        isBatchMode = isBatchMode();
    }
    //create new event processor
    try {
        eventProcessor = new DbEventRequestProcessor(appenderConfig, layout, getEventRequestProcessorListener(), isBatchMode);
    } catch (DatabaseAccessException e) {
        throw new RuntimeException("Unable to create DB event processor", e);
    }
    //start the logging thread
    queueLogger = new QueueLoggerThread(queue, eventProcessor, isBatchMode);
    queueLogger.setDaemon(true);
    queueLogger.start();
}
Also used : DbAppenederException(com.axway.ats.log.autodb.exceptions.DbAppenederException) DbEventRequestProcessor(com.axway.ats.log.autodb.DbEventRequestProcessor) QueueLoggerThread(com.axway.ats.log.autodb.QueueLoggerThread) InvalidAppenderConfigurationException(com.axway.ats.log.autodb.exceptions.InvalidAppenderConfigurationException) LogEventRequest(com.axway.ats.log.autodb.LogEventRequest) DatabaseAccessException(com.axway.ats.log.autodb.exceptions.DatabaseAccessException)

Aggregations

DbEventRequestProcessor (com.axway.ats.log.autodb.DbEventRequestProcessor)1 LogEventRequest (com.axway.ats.log.autodb.LogEventRequest)1 QueueLoggerThread (com.axway.ats.log.autodb.QueueLoggerThread)1 DatabaseAccessException (com.axway.ats.log.autodb.exceptions.DatabaseAccessException)1 DbAppenederException (com.axway.ats.log.autodb.exceptions.DbAppenederException)1 InvalidAppenderConfigurationException (com.axway.ats.log.autodb.exceptions.InvalidAppenderConfigurationException)1