Platform Framework
R24 AMR | Min(s) read

Multi-Tenant Logging

This section provides the concept of Multi-tenant logging.

Log4j2 (the default TAFJ logger) supports multi-tenant logging. When multi-tenant mode is on (i.e. tafj.multitenant=true), the TAFJTrace.properties file is auto-generated and a routing appender is created for each logger. For example:

Logback and Log4j does not support multi-tenant logging.

appender.api.type = Routing

appender.api.name = api

appender.api.routes.type = Routes

appender.api.routes.pattern = $${ctx:tenantId}

appender.api.routes.route1.type = Route

appender.api.routes.route1.file.type = RollingFile

appender.api.routes.route1.file.name = api

appender.api.routes.route1.file.fileName = ${defaultLogDirectory}/${ctx:tenantId:-}/api.log

appender.api.routes.route1.file.filePattern = ${defaultLogDirectory}/${ctx:tenantId:-}/api.log.%i.gz

appender.api.routes.route1.file.layout.type = PatternLayout

appender.api.routes.route1.file.layout.pattern = ${defaultPattern}

appender.api.routes.route1.file.policies.type = Policies

appender.api.routes.route1.file.policies.size.type = SizeBasedTriggeringPolicy

appender.api.routes.route1.file.policies.size.size=${defaultMaxFileSize}

appender.api.routes.route1.file.strategy.type = DefaultRolloverStrategy

appender.api.routes.route1.file.strategy.min = ${defaultMinBackupIndex}

appender.api.routes.route1.file.strategy.max = ${defaultMaxBackupIndex}

When a tenantId is active, it will be routed to the default log directory (generally $TAFJ_HOME/log). For example, if TenantId1 is active, logs for TenantId1 will appear under $TAFJ_HOME/log/TenantId1. If no tenant is active, then logs appear normally in the default log directory.

Likewise, COMO logs are routed to the directory based on the directory specified in the temenos.log.directory.como property (generally, if no tenant is active, then the logs are routed to $TAFJ_HOME/log_T24/como). If Tenant1 is active, then the logs are routed to $TAFJ_HOME/log_T24/como/Tenant1. For example:

appender.como.type = Routing

appender.como.name = como

appender.como.routes.type = Routes

appender.como.routes.pattern = $${ctx:COMO-NAME}

appender.como.routes.route1.type = Route

appender.como.routes.route1.file.type = File

appender.como.routes.route1.file.name = como-${ctx:COMO-NAME}

appender.como.routes.route1.file.fileName = ${sys:temenos.log.directory.como}/${ctx:tenantId:-}/${ctx:COMO-NAME}

appender.como.routes.route1.file.layout.type = PatternLayout

appender.como.routes.route1.file.layout.pattern = %m%n

In this topic

Copyright © 2020- Temenos Headquarters SA

Published on :
Monday, May 27, 2024 5:03:19 PM IST