static Builder copy(final LoggingAppender prototype) { final Builder builder = new Builder(prototype.context) .withBasePath(prototype.basePath) .withName(prototype.name) .withLogFileBaseName(prototype.logFileBaseName) .withLevel(prototype.level) .withPattern(prototype.pattern) .withMaxFileSizeInMB(prototype.maxFileSizeInMB) .withMaxHistory(prototype.maxHistory); prototype.extraPaths.forEach(builder::addPath); prototype.allowMarker.ifPresent(builder::withMarker); prototype.discriminationKey.ifPresent(builder::withDiscriminationKey); prototype.denyMarkers .map(ms -> ms.toArray(new String[ms.size()])) .ifPresent(builder::withoutMarkers); return builder; }
private static void configureRootLogger(final String loggingPath, final LoggerContext lc, final Level logLevel) { final Logger logger = lc.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); // dedicated logger for org, otherwise third-parties with 'org' // would use the 'org.dswarm' logger final Logger orgLogger = lc.getLogger("org"); logger.setLevel(logLevel); orgLogger.setLevel(logLevel); LoggingAppender.of(lc) .withBasePath(loggingPath).addPath("default") .withName("RootLogger") .withLevel(Level.DEBUG).appendTo(logger).appendTo(orgLogger) .withLevel(Level.INFO).appendTo(logger).appendTo(orgLogger) .withLevel(Level.WARN).appendTo(logger).appendTo(orgLogger) .withLevel(Level.ERROR).appendTo(logger).appendTo(orgLogger); }
private static void configureDswarmLogger(final String loggingPath, final LoggerContext lc, final Level logLevel) { final Logger logger = lc.getLogger("org.dswarm"); logger.setLevel(logLevel); LoggingAppender.of(lc) .withBasePath(loggingPath).addPath("dmp") .withName("FAT").withLevel(Level.TRACE).appendTo(logger) .withName("FAD").withLevel(Level.DEBUG).appendTo(logger) .withName("FAI").withLevel(Level.INFO).appendTo(logger) .withName("FAW").withLevel(Level.WARN).appendTo(logger) .withName("FAE").withLevel(Level.ERROR).appendTo(logger); }
private static void configureMonitoringLogger(final String loggingPath, final LoggerContext lc) { final Logger logger = lc.getLogger("dswarm.monitoring"); logger.setLevel(Level.INFO); LoggingAppender.of(lc) .withBasePath(loggingPath).addPath("monitoring") .withPattern("%date | %msg%n") .withLevel(Level.INFO) .withDiscriminationKey("entityIdentifier") // metrics log .withoutMarkers("EXECUTION", "INGEST") .withName("Monitoring") .withLogFileBaseName("metrics") .appendTo(logger) // task executions log .withMarker("EXECUTION") .withName("Execution") .withLogFileBaseName("executions") .appendTo(logger) // data model ingest log .withMarker("INGEST") .withName("Ingest") .withLogFileBaseName("ingests") .appendTo(logger); } }