/** * Initializes the logging filter. */ @PureWithSideEffects @Initialize(target = LoggingFilter.class) public static void initializeLoggingFilter() { final @Nonnull @Absolute File projectDirectory = new File("").getAbsoluteFile(); final @Nonnull String callerPrefix = "net.digitalid." + projectDirectory.getParentFile().getName() + "." + projectDirectory.getName(); LoggingFilter.filter.set(ConfigurationBasedLoggingFilter.with(Files.relativeToWorkingDirectory("config/TestingLogging.conf"), LoggingRule.with(Level.VERBOSE, callerPrefix + "."), LoggingRule.with(Level.INFORMATION))); }
/** * Initializes the output file of the logger with the given name. */ @Impure public static void initialize(@Nonnull String name) throws IllegalArgumentException, FileNotFoundException { Caller.index.set(6); Version.string.set("0.7"); LoggingFilter.filter.set(ConfigurationBasedLoggingFilter.with(Files.relativeToWorkingDirectory("config/" + name + ".conf"), LoggingRule.with(Level.INFORMATION))); Logger.logger.set(FileLogger.with(Files.relativeToWorkingDirectory("target/processor-logs/" + name + ".log"))); }
/** * Initializes the logging filter with a configuration-based logging filter. * * @throws IllegalArgumentException if a rule has an invalid level. */ @PureWithSideEffects @Initialize(target = LoggingFilter.class, dependencies = Files.class) public static void initializeLoggingFilter() throws IllegalArgumentException { if (LoggingFilter.filter.get() instanceof LevelBasedLoggingFilter) { LoggingFilter.filter.set(ConfigurationBasedLoggingFilter.with(Files.relativeToConfigurationDirectory("configs/logging.conf"), LoggingRule.with(Level.INFORMATION))); Log.verbose("Replaced the default level-based logging filter with a configuration-based logging filter."); } else { Log.verbose("Did not replace the non-default logging filter with a configuration-based logging filter."); } }