* @param loggers the loggers
*/
public static void registerLoggers(KnowledgeComponentImplementationModel model, ClassLoader loader, KieRuntimeEventManager runtimeEventManager, List<KieRuntimeLogger> loggers) {
LoggersModel loggersModel = model.getLoggers();
if (loggersModel != null) {
KieLoggers kieLoggers = KieServices.Factory.get().getLoggers();
for (LoggerModel loggerModel : loggersModel.getLoggers()) {
LoggerType loggerType = loggerModel.getType();
if (loggerType == null) {
loggerType = LoggerType.THREADED_FILE;
}
String log = Strings.trimToNull(loggerModel.getLog());
if (log == null) {
log = "event";
}
final KieRuntimeLogger logger;
switch (loggerType) {
case CONSOLE:
logger = kieLoggers.newConsoleLogger(runtimeEventManager);
break;
case FILE:
logger = kieLoggers.newFileLogger(runtimeEventManager, log);
break;
case THREADED_FILE:
Integer interval = loggerModel.getInterval();
if (interval == null) {
interval = Integer.valueOf(1000);
}
logger = kieLoggers.newThreadedFileLogger(runtimeEventManager, log, interval);
break;
default:
logger = null;
break;
}