public AccessLogProvider(Configurations configurations) { accessLog = configurations.requireFile("file"); /* Start building our access log */ final AccessLogBuilder accessLogBuilder = new AccessLogBuilder(accessLog); /* Configure log rotation, if necessary */ final String rotate = configurations.getString("rotate", null); if (rotate != null) switch (rotate.toLowerCase()) { case "daily": accessLogBuilder.rotatedDaily(); break; case "hourly": accessLogBuilder.rotatedHourly(); break; default: throw new IllegalStateException( "Unsupported value \"" + rotate + "\" for parameter \"rotate\""); } else { final String rotationPattern = configurations.getString("rotationPattern"); if (rotationPattern != null) accessLogBuilder.rotationPattern(rotationPattern); } /* Synchronous log? (not by default) */ accessLogBuilder.synchronous(configurations.get("synchronous", false)); /* Set the format, if we have to */ final String format = configurations.getString("format", null); if (format != null) accessLogBuilder.format(format); /* Finally configure time zone, if we need to... */ final String timezone = configurations.getString("timezone", null); if (timezone != null) accessLogBuilder.timeZone(timezone); /* Great! Instrument our server configurations */ probe = accessLogBuilder.build(); }