use of com.axway.ats.log.autodb.QueueLoggerThread 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();
}
Aggregations