Skip to content

Commit

Permalink
update logging facade config (by version)
Browse files Browse the repository at this point in the history
  • Loading branch information
guidograzioli committed Jun 14, 2023
1 parent c0ab925 commit db9228b
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 4 deletions.
3 changes: 2 additions & 1 deletion plugins/filter/pbkdf2_hmac.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

DOCUMENTATION = '''
name: pbkdf2_hmac
author: [email protected]
author:
- Guido Grazioli ([email protected])
version_added: '1.1.0'
short_description: Generate a salted PBKDF2_HMAC password hash
description:
Expand Down
3 changes: 2 additions & 1 deletion plugins/filter/pbkdf2_hmac.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
DOCUMENTATION:
name: pbkdf2_hmac
author: [email protected]
author:
- [email protected]
version_added: '1.1.0'
short_description: Generate a salted PBKDF2_HMAC password hash
description:
Expand Down
1 change: 1 addition & 0 deletions roles/activemq/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ activemq_logger_integration_bootstrap_level: INFO
activemq_logger_jetty_level: WARN
activemq_logger_curator_level: WARN
activemq_logger_zookeeper_level: ERROR
activemq_logger_config_template: "{{ 'log4j2.properties' if activemq_version is version_compare('2.27.0', '>=')) else 'logging.properties' }}"

# Metrics
activemq_jmx_exporter_port: 18080
Expand Down
8 changes: 8 additions & 0 deletions roles/activemq/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,10 @@ argument_specs:
description: "AMQP broker connections configuration; list of `{ name(str),uri(str),operations(list of dicts with type key in [mirror,sender,receiver,peer])) }`"
default: "[]"
type: "list"
activemq_logger_config_template:
description: "Template to use for logging facility configuration"
default: "{{ 'log4j2.properties' if activemq_version is version_compare('2.27.0', '>=')) else 'logging.properties' }}"
type: "str"
downstream:
options:
amq_broker_version:
Expand Down Expand Up @@ -570,3 +574,7 @@ argument_specs:
description: "Systemd unit name"
default: "amq_broker"
type: "str"
amq_broker_logger_config_template:
description: "Template to use for logging facility configuration"
default: "{{ 'log4j2.properties' if activemq_version is version_compare('7.11.0', '>=')) else 'logging.properties' }}"
type: "str"
4 changes: 2 additions & 2 deletions roles/activemq/tasks/configure_broker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
- name: "Configure AMQ broker logging"
become: yes
ansible.builtin.template:
src: logging.properties.j2
dest: "{{ activemq.instance_home }}/etc/logging.properties"
src: "{{ activemq_logger_config_template }}.j2"
dest: "{{ activemq.instance_home }}/etc/{{ activemq_logger_config_template }}"
owner: "{{ activemq_service_user }}"
group: "{{ activemq_service_group }}"
mode: 0644
Expand Down
99 changes: 99 additions & 0 deletions roles/activemq/templates/log4j2.properties.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# {{ ansible_managed }}
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Log4J 2 configuration

# Monitor config file every X seconds for updates
monitorInterval = 5

rootLogger = {{ activemq_logger_level }}, console, log_file

logger.activemq.name=org.apache.activemq
logger.activemq.level=INFO

logger.artemis_server.name=org.apache.activemq.artemis.core.server
logger.artemis_server.level={{ activemq_logger_core_server_level }}

logger.artemis_journal.name=org.apache.activemq.artemis.journal
logger.artemis_journal.level={{ activemq_logger_journal_level }}

logger.artemis_utils.name=org.apache.activemq.artemis.utils
logger.artemis_utils.level={{ activemq_logger_utils_level }}

# CriticalAnalyzer: If you have issues with the CriticalAnalyzer, setting this to TRACE would give
# you extra troubleshooting info, but do not use TRACE regularly as it would incur extra CPU usage.
logger.critical_analyzer.name=org.apache.activemq.artemis.utils.critical
logger.critical_analyzer.level={{ activemq_logger_utils_critical_level }}

logger.artemis_jms.name=org.apache.activemq.artemis.jms
logger.artemis_jms.level={{ activemq_logger_jms_level }}

logger.artemis_integration_bootstrap.name=org.apache.activemq.artemis.integration.bootstrap
logger.artemis_integration_bootstrap.level={{ activemq_logger_integration_bootstrap_level }}

# Audit loggers: to enable change levels from OFF to INFO
logger.audit_base = {{ 'INFO' if activemq_enable_audit else 'OFF' }}, audit_log_file
logger.audit_base.name = org.apache.activemq.audit.base
logger.audit_base.additivity = false

logger.audit_resource = {{ 'INFO' if activemq_enable_audit else 'OFF' }}, audit_log_file
logger.audit_resource.name = org.apache.activemq.audit.resource
logger.audit_resource.additivity = false

logger.audit_message = {{ 'INFO' if activemq_enable_audit else 'OFF' }}, audit_log_file
logger.audit_message.name = org.apache.activemq.audit.message
logger.audit_message.additivity = false

# Jetty logger levels
logger.jetty.name=org.eclipse.jetty
logger.jetty.level={{ activemq_logger_jetty_level }}

# Quorum related logger levels
logger.curator.name=org.apache.curator
logger.curator.level={{ activemq_logger_curator_level }}
logger.zookeeper.name=org.apache.zookeeper
logger.zookeeper.level={{ activemq_logger_zookeeper_level }}


# Console appender
appender.console.type=Console
appender.console.name=console
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=%d %-5level [%logger] %msg%n

# Log file appender
appender.log_file.type = RollingFile
appender.log_file.name = log_file
appender.log_file.fileName = ${sys:artemis.instance}/log/artemis.log
appender.log_file.filePattern = ${sys:artemis.instance}/log/artemis.log.%d{yyyy-MM-dd}
appender.log_file.layout.type = PatternLayout
appender.log_file.layout.pattern = %d %-5level [%logger] %msg%n
appender.log_file.policies.type = Policies
appender.log_file.policies.cron.type = CronTriggeringPolicy
appender.log_file.policies.cron.schedule = 0 0 0 * * ?
appender.log_file.policies.cron.evaluateOnStartup = true

# Audit log file appender
appender.audit_log_file.type = RollingFile
appender.audit_log_file.name = audit_log_file
appender.audit_log_file.fileName = ${sys:artemis.instance}/log/audit.log
appender.audit_log_file.filePattern = ${sys:artemis.instance}/log/audit.log.%d{yyyy-MM-dd}
appender.audit_log_file.layout.type = PatternLayout
appender.audit_log_file.layout.pattern = %d [AUDIT](%t) %msg%n
appender.audit_log_file.policies.type = Policies
appender.audit_log_file.policies.cron.type = CronTriggeringPolicy
appender.audit_log_file.policies.cron.schedule = 0 0 0 * * ?
appender.audit_log_file.policies.cron.evaluateOnStartup = true

0 comments on commit db9228b

Please sign in to comment.