Package fr.gouv.vitam.common.logging

# Class VitamLoggerFactory

java.lang.Object
fr.gouv.vitam.common.logging.VitamLoggerFactory

Direct Known Subclasses:
  `JdkLoggerFactory`, `LogbackLoggerFactory`

public abstract class VitamLoggerFactory extends Object
Creates an `VitamLogger` or changes the default factory implementation. This factory allows you to choose what logging framework VITAM should use. The default factory is `LogbackLoggerFactory`. If SLF4J is not available, `JdkLoggerFactory` is used. You can change it to your preferred logging framework before other VITAM classes are loaded: Please note that the new default factory is effective only for the classes which were loaded after the default factory is changed. Therefore, `setDefaultFactory(VitamLoggerFactory)` should be called as early as possible and shouldn't be called more than once.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static VitamLogLevel`
  `currentLevel`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VitamLoggerFactory(VitamLogLevel level)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static VitamLoggerFactory`
  `getDefaultFactory()`
  Returns the default factory.
  `static VitamLogger`
  `getInstance(Class<?> clazz)`
  Creates a new logger instance with the name of the specified class.
  `static VitamLogger`
  `getInstance(String name)`
  Creates a new logger instance with the specified name.
  `protected abstract VitamLogLevel`
  `getLevelSpecific()`
  `static VitamLogLevel`
  `getLogLevel()`
  `protected abstract VitamLogger`
  `newInstance(String name)`
  Creates a new logger instance with the specified name.
  `protected abstract void`
  `seLevelSpecific(VitamLogLevel level)`
  Set the level for the specific implementation
  `static void`
  `setDefaultFactory(VitamLoggerFactory defaultFactory)`
  Changes the default factory.
  `protected static void`
  `setInternalLogLevel(VitamLogLevel level)`
  `static void`
  `setLogLevel(VitamLogLevel level)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### currentLevel

    protected static VitamLogLevel currentLevel

- ## Constructor Details

  - ### VitamLoggerFactory

    public VitamLoggerFactory(VitamLogLevel level)
    Parameters:
      `level` - the vitam log level

- ## Method Details

  - ### getDefaultFactory

    public static VitamLoggerFactory getDefaultFactory()
    Returns the default factory. The initial default factory is `JdkLoggerFactory`.
    Returns:
      the current default Factory

  - ### setDefaultFactory

    public static void setDefaultFactory(VitamLoggerFactory defaultFactory)
    Changes the default factory.
    Parameters:
      `defaultFactory` - instance of VitamLoggerFactory

  - ### getInstance

    public static VitamLogger getInstance(Class<?> clazz)
    Creates a new logger instance with the name of the specified class.
    Parameters:
      `clazz` - specified class
    Returns:
      the logger instance

  - ### getInstance

    public static VitamLogger getInstance(String name)
    Creates a new logger instance with the specified name.
    Parameters:
      `name` - to create new logger instance
    Returns:
      the logger instance

  - ### getLogLevel

    public static VitamLogLevel getLogLevel()
    Returns:
      the current Level used

  - ### setLogLevel

    public static void setLogLevel(VitamLogLevel level)
    Parameters:
      `level` - the vitam log level

  - ### setInternalLogLevel

    protected static void setInternalLogLevel(VitamLogLevel level)

  - ### getLevelSpecific

    protected abstract VitamLogLevel getLevelSpecific()
    Returns:
      should return the current Level for the specific implementation

  - ### seLevelSpecific

    protected abstract void seLevelSpecific(VitamLogLevel level)
    Set the level for the specific implementation
    Parameters:
      `level` -

  - ### newInstance

    protected abstract VitamLogger newInstance(String name)
    Creates a new logger instance with the specified name.