Class LogFileConfiguration

java.lang.Object
com.couchbase.lite.LogFileConfiguration

public final class LogFileConfiguration extends Object
A class that describes the file configuration for the FileLogger class. Once a configuration has been assigned to a Logger, it becomes read-only: an attempt to mutate it will cause an exception. To change the configuration of a logger, copy its configuration, mutate the copy and then use it to replace the loggers current configuration.
  • Constructor Details

    • LogFileConfiguration

      public LogFileConfiguration(@NonNull String directory)
      Constructs a file configuration object with the given directory
      Parameters:
      directory - The directory that the logs will be written to
    • LogFileConfiguration

      public LogFileConfiguration(@NonNull LogFileConfiguration config)
      Constructs a file configuration object based on another one so that it may be modified
      Parameters:
      config - The other configuration to copy settings from
    • LogFileConfiguration

      public LogFileConfiguration(@NonNull String directory, @Nullable LogFileConfiguration config)
      Constructs a file configuration object based on another one but changing the directory
      Parameters:
      directory - The directory that the logs will be written to
      config - The other configuration to copy settings from
  • Method Details

    • setMaxSize

      @NonNull public LogFileConfiguration setMaxSize(long maxSize)
      Sets the max size of the log file in bytes. If a log file passes this size then a new log file will be started. This number is a best effort and the actual size may go over slightly. The default size is 500Kb.
      Parameters:
      maxSize - The max size of the log file in bytes
      Returns:
      The self object
    • setMaxRotateCount

      @NonNull public LogFileConfiguration setMaxRotateCount(int maxRotateCount)
      Sets the number of rotated logs that are saved. For instance, if the value is 1 then 2 logs will be present: the 'current' log and the previous 'rotated' log. The default value is 1.
      Parameters:
      maxRotateCount - The number of rotated logs to be saved
      Returns:
      The self object
    • setUsePlaintext

      @NonNull public LogFileConfiguration setUsePlaintext(boolean usePlaintext)
      Sets whether or not CBL logs in plaintext. The default (false) is to log in a binary encoded format that is more CPU and I/O friendly. Enabling plaintext is not recommended in production.
      Parameters:
      usePlaintext - Whether or not to log in plaintext
      Returns:
      The self object
    • getDirectory

      @NonNull public String getDirectory()
      Gets the directory that the logs files are stored in.
      Returns:
      The directory that the logs files are stored in.
    • getMaxSize

      public long getMaxSize()
      Gets the max size of the log file in bytes. If a log file passes this size then a new log file will be started. This number is a best effort and the actual size may go over slightly. The default size is 500Kb.
      Returns:
      The max size of the log file in bytes
    • getMaxRotateCount

      public int getMaxRotateCount()
      Gets the number of rotated logs that are saved. For instance, if the value is 1 then 2 logs will be present: the 'current' log and the previous 'rotated' log. The default value is 1.
      Returns:
      The number of rotated logs that are saved
    • usesPlaintext

      public boolean usesPlaintext()
      Gets whether or not CBL is logging in plaintext. The default (false) is to log in a binary encoded format that is more CPU and I/O friendly. Enabling plaintext is not recommended in production.
      Returns:
      Whether or not CBL is logging in plaintext
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object