Package org.wso2.carbon.utils.logging
Class TenantAwarePatternLayout
- java.lang.Object
-
- org.apache.log4j.Layout
-
- org.apache.log4j.PatternLayout
-
- org.wso2.carbon.utils.logging.TenantAwarePatternLayout
-
- All Implemented Interfaces:
org.apache.log4j.spi.OptionHandler
@Deprecated public class TenantAwarePatternLayout extends org.apache.log4j.PatternLayout
Deprecated.tenantId is appended to layout in log4j2.propertiesA log4j pattern layout implementation capable of capturing tenant details from the Carbon Context. In addition to the default conversion characters, the character 'T' can be used to insert a tenant identifier, the character 'D' can be used to insert a tenant domain, and the character 'U' can be used to insert the username, character 'S' can be used to insert the Service name. The special character 'P' can be used to insert a pattern layout, that will get printed if tenant information is available. The default layout for this is%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%n
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_TENANT_PATTERNDeprecated.The default pattern to be injected in tenant-mode.
-
Constructor Summary
Constructors Constructor Description TenantAwarePatternLayout()Deprecated.The default constructor.TenantAwarePatternLayout(String pattern)Deprecated.Constructor accepting a layout pattern.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected org.apache.log4j.helpers.PatternParsercreatePatternParser(String pattern)Deprecated.voidsetLogUUIDUpdateInterval(String logUUIDUpdateInterval)Deprecated.Method to set the logUUID update interval.static voidsetSuperTenantText(String superTenantText)Deprecated.Method to set the string that will be put in place of the log pattern layout for the super tenant.voidsetTenantPattern(String tenantPattern)Deprecated.Method to set the log pattern layout for tenants.
-
-
-
Field Detail
-
DEFAULT_TENANT_PATTERN
public static final String DEFAULT_TENANT_PATTERN
Deprecated.The default pattern to be injected in tenant-mode.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TenantAwarePatternLayout
public TenantAwarePatternLayout()
Deprecated.The default constructor.
-
TenantAwarePatternLayout
public TenantAwarePatternLayout(String pattern)
Deprecated.Constructor accepting a layout pattern.- Parameters:
pattern- the layout pattern.
-
-
Method Detail
-
createPatternParser
protected org.apache.log4j.helpers.PatternParser createPatternParser(String pattern)
Deprecated.- Overrides:
createPatternParserin classorg.apache.log4j.PatternLayout
-
setTenantPattern
public void setTenantPattern(String tenantPattern)
Deprecated.Method to set the log pattern layout for tenants.- Parameters:
tenantPattern- the log pattern layout for tenants.
-
setLogUUIDUpdateInterval
public void setLogUUIDUpdateInterval(String logUUIDUpdateInterval)
Deprecated.Method to set the logUUID update interval. Unit is hours.- Parameters:
logUUIDUpdateInterval-
-
setSuperTenantText
public static void setSuperTenantText(String superTenantText)
Deprecated.Method to set the string that will be put in place of the log pattern layout for the super tenant.- Parameters:
superTenantText- the string that will be put in place of the log pattern layout for the super tenant.
-
-