public class TenantAwarePatternLayout
extends org.apache.log4j.PatternLayout
%U@%D [%T]
. If tenant information is not available an empty
string will be returned. The tenant pattern can be changed via the log4j
configuration. You simply need to add a line in the format,
log4j.appender.NAME.layout.TenantPattern=%U@%D [%T]
.
Available patterns:
[%D] - tenant domain
[%P] - tenant pattern (TenantPattern as configured in the log4j.properties file. eg:
%U%@%D[%T] - will be converted to "username @ tenant_domain [tenant_id]" )
[%T] - tenant id
[%S] - server name
[%U] - user name
[%A] - application name
[%H] - host name/address
[%I] - instance id
How to use these patterns:
Configure the log4j.properties file using above patterns.
eg: for the console appender,
log4j.appender.CARBON_CONSOLE.layout.ConversionPattern=TID: [%T] [%S] [%U] [%A] [%D] [%I] [%H]
[%P] [%d] %P%5p {%c} - %x %m%nModifier and Type | Field and Description |
---|---|
static String |
DEFAULT_TENANT_PATTERN
The default pattern to be injected in tenant-mode.
|
Constructor and Description |
---|
TenantAwarePatternLayout()
The default constructor.
|
TenantAwarePatternLayout(String pattern)
Constructor accepting a layout pattern.
|
Modifier and Type | Method and Description |
---|---|
protected org.apache.log4j.helpers.PatternParser |
createPatternParser(String pattern) |
void |
setLogUUIDUpdateInterval(String logUUIDUpdateInterval)
Method to set the logUUID update interval.
|
static void |
setSuperTenantText(String superTenantText)
Method to set the string that will be put in place of the log pattern
layout for the super tenant.
|
void |
setTenantPattern(String tenantPattern)
Method to set the log pattern layout for tenants.
|
public static final String DEFAULT_TENANT_PATTERN
public TenantAwarePatternLayout()
public TenantAwarePatternLayout(String pattern)
pattern
- the layout pattern.protected org.apache.log4j.helpers.PatternParser createPatternParser(String pattern)
createPatternParser
in class org.apache.log4j.PatternLayout
public void setTenantPattern(String tenantPattern)
tenantPattern
- the log pattern layout for tenants.public void setLogUUIDUpdateInterval(String logUUIDUpdateInterval)
logUUIDUpdateInterval
- public static void setSuperTenantText(String superTenantText)
superTenantText
- the string that will be put in place of the log pattern layout
for the super tenant.Copyright © 2016 WSO2 Inc. All rights reserved.