Module io.jooby
Package io.jooby

Interface LoggingService


public interface LoggingService
Describe the underlying logging system. Jooby provides two implementation: jooby-logback and jooby-log4j. You might want to add one of these to your classpath, yet still these are optional.
Since:
3.0.1
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    configure(ClassLoader classLoader, List<String> names)
    Initializes the logback.configurationFile system property when a logback[.env].xml file is found at user.dir/conf directory or user.dir.
    List of possible names for configuration file.
    System property to instruct the logging system where the configuration file is.
    void
    Utility method to temporarily turn OFF a logger while running an action.
  • Method Details

    • getPropertyName

      String getPropertyName()
      System property to instruct the logging system where the configuration file is. Example: logback.configurationFile = ...
      Returns:
      System property to instruct the logging system where the configuration file is.
    • getLogFileName

      List<String> getLogFileName()
      List of possible names for configuration file. Like: logback.xml, log4j.properties, etc.. .
      Returns:
      List of possible names for configuration file.
    • logOff

      void logOff(List<String> logger, SneakyThrows.Runnable task)
      Utility method to temporarily turn OFF a logger while running an action.
      Parameters:
      logger - List of logger names.
      task - Action to run.
    • configure

      static String configure(@NonNull ClassLoader classLoader, @NonNull List<String> names)
      Initializes the logback.configurationFile system property when a logback[.env].xml file is found at user.dir/conf directory or user.dir.

      Initializes the log4j.configurationFile system property when a log4j[.env].[ext] file is found at user.dir/conf directory or user.dir. Extension can be one of: .xml, .properties, .yaml or .json.

      Parameters:
      classLoader - Class loader to use.
      names - Actives environment names. Useful for choosing an environment specific logging configuration file.