use of org.apache.samza.config.Log4jSystemConfig in project samza by apache.
the class StreamAppender method setupSystem.
protected void setupSystem() {
config = getConfig();
SystemFactory systemFactory = null;
Log4jSystemConfig log4jSystemConfig = new Log4jSystemConfig(config);
if (streamName == null) {
streamName = getStreamName(log4jSystemConfig.getJobName(), log4jSystemConfig.getJobId());
}
String systemName = log4jSystemConfig.getSystemName();
String systemFactoryName = log4jSystemConfig.getSystemFactory(systemName);
if (systemFactoryName != null) {
systemFactory = Util.<SystemFactory>getObj(systemFactoryName);
} else {
throw new SamzaException("Could not figure out \"" + systemName + "\" system factory for log4j StreamAppender to use");
}
setSerde(log4jSystemConfig, systemName, streamName);
systemProducer = systemFactory.getProducer(systemName, config, new MetricsRegistryMap());
systemStream = new SystemStream(systemName, streamName);
systemProducer.register(SOURCE);
systemProducer.start();
log.info(SOURCE + " has been registered in " + systemName + ". So all the logs will be sent to " + streamName + " in " + systemName + ". Logs are partitioned by " + key);
}
Aggregations