diff --git a/helm/templates/log-configmap.yaml b/helm/templates/log-configmap.yaml new file mode 100644 index 0000000..b88a06f --- /dev/null +++ b/helm/templates/log-configmap.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "schema-registry.fullname" . }}-log-configmap + labels: + {{- include "schema-registry.labels.standard" . | nindent 4 }} +data: + log4j.properties: |- + log4j.rootLogger={{ .Values.logging.level }}, stdout + + log4j.appender.stdout=org.apache.log4j.ConsoleAppender + log4j.appender.stdout.layout=org.apache.log4j.PatternLayout + log4j.appender.stdout.layout.ConversionPattern=[%d] [%p] [%t] [%c] - %m%n + + log4j.logger.kafka=ERROR, stdout + log4j.additivity.kafka=false + {{- if .Values.logging.extraLogConfig }} + {{- range $key,$value := .Values.logging.extraLogConfig }} + log4j.logger.{{ $value.name }}={{ $value.level }}, stdout + log4j.additivity.{{ $value.name }}=false + {{- end }} + {{- end }} \ No newline at end of file diff --git a/helm/templates/statefulset.yaml b/helm/templates/statefulset.yaml index 7e5e7e5..f825420 100644 --- a/helm/templates/statefulset.yaml +++ b/helm/templates/statefulset.yaml @@ -44,6 +44,10 @@ spec: {{- toYaml .Values.readinessProbe | nindent 12 }} resources: {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: log-config + mountPath: /opt/schema-registry/etc/schema-registry/log4j.properties + subPath: "log4j.properties" env: - name: SCHEMA_REGISTRY_HOST_NAME valueFrom: @@ -107,6 +111,9 @@ spec: terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} {{- if .Values.prometheus.jmx.enabled }} volumes: + - name: log-config + configMap: + name: {{ template "schema-registry.fullname" . }}-log-configmap - name: jmx-config configMap: name: {{ template "schema-registry.fullname" . }}-jmx-configmap diff --git a/helm/values.yaml b/helm/values.yaml index 33eb497..3e13c8d 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -145,3 +145,13 @@ servicemonitor: interval: 15s secure: false tlsConfig: {} + +logging: + level: WARN + extraLogConfig: + kafka: + name: org.apache.kafka + level: ERROR + zookeeper: + name: org.apache.zookeeper + level: ERROR