Package com.yahoo.log

Class LogSetup

java.lang.Object
com.yahoo.log.LogSetup

public class LogSetup extends Object
Sets up Vespa logging. Call a setup method to set up this.
Author:
Bjorn Borud, arnej27959
  • Constructor Details

    • LogSetup

      public LogSetup()
  • Method Details

    • clearHandlers

      public static void clearHandlers()
      Clear all handlers registered in java.util.logging framework
    • initVespaLogging

      public static void initVespaLogging(String programName)
      Every Vespa application should call initVespaLogging exactly one time. This should be done from the main() method or from a static initializer in the main class. The library will pick up the environment variables usually set by the Vespa config-sentinel (VESPA_LOG_LEVEL, VESPA_LOG_TARGET, VESPA_SERVICE_NAME, VESPA_LOG_CONTROL_DIR) but it's possible to override these by setting system properties before calling initVespaLogging. This may be useful for unit testing etc:
      System.setProperty("vespa.log.level", "all")
      System.setProperty("vespa.log.target", "file:foo.log")
      System.setProperty("vespa.service.name", "my.name")
      System.setProperty("vespa.log.control.dir", ".")
      System.setProperty("vespa.log.control.file", "my.logcontrol")
      vespa.log.control.file is used if it's set, otherwise it's vespa.log.control.dir + "/" + vespa.service.name + ".logcontrol" if both of those variables are set, otherwise there will be no runtime log control.
      Parameters:
      programName - the name of the program that is running; this is added as a prefix to the logger name to form the "component" part of the log message. (Usually the logger name is the name of the class that logs something, so the programName should be kept short and simple.)
    • cleanup

      public static void cleanup()
      perform cleanup