From 16e05cc668907976218551afed6476d53aeb5e97 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Mon, 21 Jun 2021 15:22:50 -0400 Subject: [PATCH] Add support for log4j.properties Signed-off-by: Paul Belanger Change-Id: I9dc68f892852aef42d45c783abd9fb908565a85e --- defaults/main.yaml | 6 ++++++ tasks/config.yaml | 10 ++++++++++ templates/etc/zookeeper/conf/log4j.properties | 13 +++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 templates/etc/zookeeper/conf/log4j.properties diff --git a/defaults/main.yaml b/defaults/main.yaml index 2fcd4b6..1803854 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -26,6 +26,12 @@ zookeeper_user_home: /var/lib/zookeeper zookeeper_user_home_mode: 0750 # zookeeper_user_shell: +zookeeper_file_log4j_properties_dest: /etc/zookeeper/conf/log4j.properties +zookeeper_file_log4j_properties_group: zookeeper +zookeeper_file_log4j_properties_mode: 0644 +zookeeper_file_log4j_properties_owner: zookeeper +zookeeper_file_log4j_properties_src: etc/zookeeper/conf/log4j.properties + zookeeper_file_myid_group: zookeeper zookeeper_file_myid_mode: 0644 zookeeper_file_myid_owner: zookeeper diff --git a/tasks/config.yaml b/tasks/config.yaml index fbc2098..c6d1c50 100644 --- a/tasks/config.yaml +++ b/tasks/config.yaml @@ -44,6 +44,16 @@ - /etc/zookeeper/conf - /var/log/zookeeper +- name: Install zookeeper log4j.properties + become: yes + template: + dest: "{{ zookeeper_file_log4j_properties_dest }}" + group: "{{ zookeeper_file_log4j_properties_group }}" + mode: "{{ zookeeper_file_log4j_properties_mode }}" + owner: "{{ zookeeper_file_log4j_properties_owner }}" + src: "{{ zookeeper_file_log4j_properties_src }}" + register: zookeeper_file_log4j_properties + - name: Install zookeeper myid become: yes template: diff --git a/templates/etc/zookeeper/conf/log4j.properties b/templates/etc/zookeeper/conf/log4j.properties new file mode 100644 index 0000000..e52c247 --- /dev/null +++ b/templates/etc/zookeeper/conf/log4j.properties @@ -0,0 +1,13 @@ +# This file is generated by Ansible +# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN +# +log4j.rootLogger=${zookeeper.root.logger} + +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.Threshold=INFO +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n + +log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender +log4j.appender.ROLLINGFILE.Threshold=DEBUG +log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/zookeeper.log