Skip to content

Commit

Permalink
make logging configurable via helm (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
kishansairam9 authored Sep 30, 2024
1 parent 8db6125 commit 08e013d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
22 changes: 22 additions & 0 deletions helm/templates/log-configmap.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
7 changes: 7 additions & 0 deletions helm/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 08e013d

Please sign in to comment.