Logging

@Serializable
class Logging(val level: Server.Logging.Level = Level.DEBUG, val enableConsoleLogging: Boolean = true, val enableFileLogging: Boolean = true, val logRoot: String = ".kobweb/server/logs", val clearLogsOnStart: Boolean = true, val logFileBaseName: String = "kobweb-server", val maxFileCount: Int? = null, val totalSizeCap: DataSize? = 10.mebibytes, val compressHistory: Boolean = true)(source)

Configuration for logging.

By default, logs append to a single file and rollover at the end of each day.

Parameters

level

The minimum level of log messages to show. If set to Level.OFF, no logs will be shown. See the Level enum for more details. Level.DEBUG is a decent balance of verbosity and usefulness. Level.TRACE is incredibly verbose, and is mostly intended for locally debugging. It probably shouldn't be used in production, but it can be helpful when trying to debug a particularly tricky issue (such as a CORS misconfiguration or a case where the ktor server is sending you back 403s).

enableConsoleLogging

If true, logs will be written to stdout/stderr.

enableFileLogging

If true, logs will be written to a file (in addition to stdout/stderr). If false, logs will only be written to stdout/stderr. If false, the other file-related properties in this class will essentially be ignored.

logRoot

The root directory where logs will be stored. If you change this to a directory that will contain other files besides just logs, consider setting clearLogsOnStart to false.

clearLogsOnStart

If true, all existing files under the log root will be deleted when a server is started in dev mode. Be careful if you changed logRoot to a path with non-log files in it!

logFileBaseName

The base name of the log file. A log suffix will automatically be added. Later, if the logs roll over, they'll be archived, and the base name will be used again in that context.

maxFileCount

The maximum number of log files to keep before old entries get deleted. Pass in null (or 0) to indicate unbounded file count.

totalSizeCap

The maximum size of all log files before old entries get deleted. Pass in null (or "0b") to indicate unbounded size.

compressHistory

If true, log files will be compressed when they roll over.

Constructors

Link copied to clipboard
constructor(level: Server.Logging.Level = Level.DEBUG, enableConsoleLogging: Boolean = true, enableFileLogging: Boolean = true, logRoot: String = ".kobweb/server/logs", clearLogsOnStart: Boolean = true, logFileBaseName: String = "kobweb-server", maxFileCount: Int? = null, totalSizeCap: DataSize? = 10.mebibytes, compressHistory: Boolean = true)

Types

Link copied to clipboard

The various logging levels supported by Logback, the engine used by the server to do logging.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val maxFileCount: Int? = null
Link copied to clipboard