Class Log

java.lang.Object
org.basex.server.Log
All Implemented Interfaces:
QueryTracer

public final class Log extends Object implements QueryTracer
This class writes daily log files to disk. The log format has been updated in Version 7.4; it now has the following columns:
  • Time: timestamp (format: xs:time)
  • Address: host name and port of the requesting client
  • User: user name
  • Type: Type of log message: REQUEST, OK or ERROR
  • Info: Log message
  • Performance: Measured time in milliseconds
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

  • Constructor Details

    • Log

      public Log(StaticOptions sopts)
      Constructor.
      Parameters:
      sopts - static options
  • Method Details

    • file

      public LogFile file(String name)
      Returns a log file for the specified name (current or new instance).
      Parameters:
      name - name of log file
      Returns:
      log file, or null if it does not exist
    • writeServer

      public void writeServer(Log.LogType type, String info)
      Writes a server entry to the log file.
      Parameters:
      type - log type
      info - info string (can be null)
    • write

      public void write(Log.LogType type, String info, Performance perf, Context ctx)
      Writes an entry to the log file.
      Parameters:
      type - type
      info - info string (can be null)
      perf - performance object (can be null)
      ctx - database context
    • write

      public void write(Log.LogType type, String info, Performance perf, String address, Context ctx)
      Writes an entry to the log file.
      Parameters:
      type - type
      info - info string (can be null)
      perf - performance object (can be null)
      address - address (can be null)
      ctx - database context
    • write

      public void write(Object type, String info, Performance perf, Context ctx)
      Writes an entry to the log file.
      Parameters:
      type - type (Log.LogType, HTTP status code or custom string)
      info - info string (can be null)
      perf - performance object (can be null)
      ctx - database context
    • close

      public void close()
      Closes the log file.
    • files

      public IOFile[] files()
      Returns all log files.
      Returns:
      log directory
    • print

      public boolean print(String info)
      Description copied from interface: QueryTracer
      Processes tracing output.
      Specified by:
      print in interface QueryTracer
      Parameters:
      info - string to be output
      Returns:
      true if string shall be further processed by the calling function