Class 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.properties
    A 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 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:
        createPatternParser in class org.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.