aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java28
1 files changed, 18 insertions, 10 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
index ef5b29ccfb8..69ebb67c908 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
@@ -36,8 +36,10 @@ import com.yahoo.config.provision.Zone;
import com.yahoo.config.provision.ZoneEndpoint;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.container.bundle.BundleInstantiationSpecification;
+import com.yahoo.container.logging.AccessLog;
import com.yahoo.container.logging.FileConnectionLog;
import com.yahoo.io.IOUtils;
+import com.yahoo.jdisc.http.server.jetty.VoidRequestLog;
import com.yahoo.osgi.provider.model.ComponentModel;
import com.yahoo.path.Path;
import com.yahoo.schema.OnnxModel;
@@ -417,19 +419,26 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
protected void addAccessLogs(DeployState deployState, ApplicationContainerCluster cluster, Element spec) {
List<Element> accessLogElements = getAccessLogElements(spec);
- if (cluster.isHostedVespa() && !accessLogElements.isEmpty()) {
- accessLogElements.clear();
- log.logApplicationPackage(
- Level.WARNING, "Applications are not allowed to override the 'accesslog' element");
+ if (accessLogElements.isEmpty() && deployState.getAccessLoggingEnabledByDefault()) {
+ cluster.addAccessLog();
} else {
- for (Element accessLog : accessLogElements) {
- AccessLogBuilder.buildIfNotDisabled(deployState, cluster, accessLog).ifPresent(cluster::addComponent);
+ if (cluster.isHostedVespa()) {
+ log.logApplicationPackage(WARNING, "Applications are not allowed to override the 'accesslog' element");
+ } else {
+ List<AccessLogComponent> components = new ArrayList<>();
+ for (Element accessLog : accessLogElements) {
+ AccessLogBuilder.buildIfNotDisabled(deployState, cluster, accessLog).ifPresent(accessLogComponent -> {
+ components.add(accessLogComponent);
+ cluster.addComponent(accessLogComponent);
+ });
+ }
+ if (components.size() > 0) {
+ cluster.removeSimpleComponent(VoidRequestLog.class);
+ cluster.addSimpleComponent(AccessLog.class);
+ }
}
}
- if (accessLogElements.isEmpty() && deployState.getAccessLoggingEnabledByDefault())
- cluster.addDefaultSearchAccessLog();
-
// Add connection log if access log is configured
if (cluster.getAllComponents().stream().anyMatch(component -> component instanceof AccessLogComponent))
cluster.addComponent(new ConnectionLogComponent(cluster, FileConnectionLog.class, "access"));
@@ -439,7 +448,6 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
return XML.getChildren(spec, "accesslog");
}
-
protected void addHttp(DeployState deployState, Element spec, ApplicationContainerCluster cluster, ConfigModelContext context) {
Element httpElement = XML.getChild(spec, "http");
if (httpElement != null) {