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 Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    perform cleanup
    static void
    Clear all handlers registered in java.util.logging framework
    static com.yahoo.log.VespaLogHandler
    Deprecated, for removal: This API element is subject to removal in a future version.
    Should only be used internally in the log library
    static Timer
    Deprecated, for removal: This API element is subject to removal in a future version.
    Just construct a java.util.Timer instead
    static void
    initVespaLogging(String programName)
    Every Vespa application should call initVespaLogging exactly one time.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LogSetup

      public LogSetup()
  • Method Details

    • getTaskRunner

      @Deprecated(since="7", forRemoval=true) public static Timer getTaskRunner()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Just construct a java.util.Timer instead
      A global task thread
    • 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.)
    • getLogHandler

      @Deprecated(since="7", forRemoval=true) public static com.yahoo.log.VespaLogHandler getLogHandler()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Should only be used internally in the log library
      Returns the log handler set up by this class
    • cleanup

      public static void cleanup()
      perform cleanup