Class LogDomains

java.lang.Object
com.sun.logging.LogDomains

public class LogDomains extends Object
Class LogDomains
  • Field Details

  • Constructor Details

    • LogDomains

      public LogDomains()
  • Method Details

    • getLogger

      public static Logger getLogger(Class<?> clazz, String loggerNamePrefix)
      Returns initialized logger using resource bundle found by the class's classloader.

      Logger name will be constructed as ${loggerNamePrefix}.$(clazz.getPackageName())

      Locating the resource bundle:

      1. If the loggerNamePrefix starts with jakarta., this prefix is replaced by com.sun.logging.
      2. If the resource bundle is not found, method tries to go through class's package hierarchy to find the closest LogStrings.properties file.
      Parameters:
      clazz - - owner of the logger instance.
      loggerNamePrefix -
      Returns:
      Logger, never null
    • getLogger

      public static Logger getLogger(Class<?> clazz, String loggerNamePrefix, boolean findResourceBundle)
      Returns initialized logger.

      If the resourceBundleLookup is true, uses the clazz's classloader to find and load the LogStrings.properties file.

      Logger name will be constructed as ${loggerNamePrefix}.$(clazz.getPackageName())

      Locating the resource bundle (if requested):

      1. If the loggerNamePrefix starts with jakarta., this prefix is replaced by com.sun.logging.
      2. If the resource bundle is not found, method tries to go through class's package hierarchy to find the closest LogStrings.properties file.
      Parameters:
      clazz - - owner of the logger instance.
      loggerNamePrefix -
      findResourceBundle - - try to find the resource bundle for the logger now.
      Returns:
      Logger, never null
    • getLogger

      public static Logger getLogger(Class<?> clazz, String loggerNamePrefix, ClassLoader rbLoader)
      Returns initialized logger.

      Locating the resource bundle:

      1. Uses provided classloader, which allows to use resource bundle from another jar file
      2. If the loggerNamePrefix starts with jakarta., this prefix is replaced by com.sun.logging.
      3. If the resource bundle is not found, method tries to go through class's package hierarchy to find the closest LogStrings.properties file.
      Parameters:
      clazz - - owner of the logger instance.
      loggerNamePrefix -
      rbLoader - - try to find the resource bundle for the logger now.
      Returns:
      Logger, never null