Class LogConfigurator

org.elasticsearch.common.logging.LogConfigurator

public class LogConfigurator extends
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    configure​(Environment environment)
    Configure logging reading from any log4j2.properties found in the config directory and its subdirectories from the specified environment.
    static void
    Configure logging without reading a log4j2.properties file, effectively configuring the status logger and all loggers to the console.
    static void
    Load logging plugins so we can have node_name in the pattern.
    static void
    Registers a listener for status logger errors.
    static void
     nodeName)
    Sets the node name.

    Methods inherited from class java.lang.

    , , , , , , , , , ,
  • Constructor Details

    • LogConfigurator

      public LogConfigurator()
  • Method Details

    • registerErrorListener

      public static void registerErrorListener()
      Registers a listener for status logger errors. This listener should be registered as early as possible to ensure that no errors are logged by the status logger before logging is configured.
    • configureWithoutConfig

      public static void configureWithoutConfig(Settings settings)
      Configure logging without reading a log4j2.properties file, effectively configuring the status logger and all loggers to the console.
      Parameters:
      settings - for configuring logger.level and individual loggers
    • configure

      public static void configure(Environment environment) throws , org.elasticsearch.cli.UserException
      Configure logging reading from any log4j2.properties found in the config directory and its subdirectories from the specified environment. Will also configure logging to point the logs directory from the specified environment.
      Parameters:
      environment - the environment for reading configs and the logs path
      Throws:
      - if there is an issue readings any log4j2.properties in the config directory
      org.elasticsearch.cli.UserException - if there are no log4j2.properties in the specified configs path
    • loadLog4jPlugins

      public static void loadLog4jPlugins()
      Load logging plugins so we can have node_name in the pattern.
    • setNodeName

      public static void setNodeName( nodeName)
      Sets the node name. This is called before logging is configured if the node name is set in elasticsearch.yml. Otherwise it is called as soon as the node id is available.