use of io.undertow.server.handlers.accesslog.ExtendedAccessLogParser in project wildfly by wildfly.
the class AccessLogService method start.
@Override
public void start(StartContext context) throws StartException {
if (useServerLog) {
logReceiver = new JBossLoggingAccessLogReceiver();
} else {
if (pathRelativeTo != null) {
callbackHandle = pathManager.getValue().registerCallback(pathRelativeTo, PathManager.ReloadServerCallback.create(), PathManager.Event.UPDATED, PathManager.Event.REMOVED);
}
directory = Paths.get(pathManager.getValue().resolveRelativePathEntry(path, pathRelativeTo));
if (!Files.exists(directory)) {
try {
Files.createDirectories(directory);
} catch (IOException e) {
throw UndertowLogger.ROOT_LOGGER.couldNotCreateLogDirectory(directory, e);
}
}
try {
DefaultAccessLogReceiver.Builder builder = DefaultAccessLogReceiver.builder().setLogWriteExecutor(worker.getValue()).setOutputDirectory(directory).setLogBaseName(filePrefix).setLogNameSuffix(fileSuffix).setRotate(rotate);
if (extended) {
builder.setLogFileHeaderGenerator(new ExtendedAccessLogParser.ExtendedAccessLogHeaderGenerator(pattern));
extendedPattern = new ExtendedAccessLogParser(getClass().getClassLoader()).parse(pattern);
} else {
extendedPattern = null;
}
logReceiver = builder.build();
} catch (IllegalStateException e) {
throw new StartException(e);
}
}
host.getValue().setAccessLogService(this);
}
Aggregations