Skip to content

Commit

Permalink
Merge pull request #187 from guidograzioli/logfile_path
Browse files Browse the repository at this point in the history
Add parameter `activemq_logger_filepath` to configure logfile path
  • Loading branch information
guidograzioli authored Oct 1, 2024
2 parents 466572a + d7204f6 commit 3acd718
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions roles/activemq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ See _Role Variables_ below for additional TLS/SSL settings.
|`activemq_logger_audit_rollover_files`| Number of rollover audit log files | `5` | `'log4j2.properties' if activemq_version is version_compare('2.27.0', '>=') else 'logging.properties'` |
|`activemq_logger_config_template_path` | Optional subdirectory of any playbook template lookup directories for the logging facility configuration | `''` |
|`activemq_logger_config_keep_name` | Whether to keep the custom template filename or use the default | `False` |
|`activemq_logger_filepath` | Path for main logfile relative to instance directory | `/log/artemis.log` |


#### Broker plugins
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 @@ -238,6 +238,7 @@ activemq_logger_config_template_path: ''
activemq_logger_config_keep_name: false
activemq_logger_rollover_files: 5
activemq_logger_audit_rollover_files: 5
activemq_logger_filepath: /log/artemis.log

# Metrics
activemq_jmx_exporter_port: 18080
Expand Down
4 changes: 4 additions & 0 deletions roles/activemq/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,10 @@ argument_specs:
description: "Whether or not to enable clustering (cluster-connections)"
default: "{{ activemq_ha_enabled }}"
type: 'bool'
activemq_logger_filepath:
description: "Path for main logfile relative to instance directory."
default: "/log/artemis.log"
type: 'str'
systemd:
options:
activemq_version:
Expand Down
6 changes: 3 additions & 3 deletions roles/activemq/templates/log4j2.properties.j2
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ 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.fileName = ${sys:artemis.instance}{{ activemq_logger_filepath }}
appender.log_file.filePattern = ${sys:artemis.instance}{{ activemq_logger_filepath }}.%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
Expand All @@ -100,4 +100,4 @@ 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
appender.audit_log_file.strategy.type=DefaultRolloverStrategy
appender.audit_log_file.strategy.max={{ activemq_logger_audit_rollover_files }}
appender.audit_log_file.strategy.max={{ activemq_logger_audit_rollover_files }}
2 changes: 1 addition & 1 deletion roles/activemq/templates/logging.properties.j2
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ handler.FILE.properties=suffix,append,autoFlush,fileName
handler.FILE.suffix=.yyyy-MM-dd
handler.FILE.append=true
handler.FILE.autoFlush=true
handler.FILE.fileName=${artemis.instance}/log/artemis.log
handler.FILE.fileName=${artemis.instance}{{ activemq_logger_filepath }}
handler.FILE.formatter=PATTERN

# Formatter pattern configuration
Expand Down

0 comments on commit 3acd718

Please sign in to comment.