LogManager

object LogManager

Logging utilities: path helpers, log file switching, and root level updates.

This helper assumes your Log4j2 configuration references the system property baseLogFileName (e.g., using ${sys:baseLogFileName} in the RollingFile appender).

Notes:

  • This object’s name intentionally matches Log4j’s type name. Calls to Log4j's static helpers are fully qualified through imports (e.g., LogManager.getContext) and remain unambiguous.

  • All path helpers ensure the ${Constants.NEWBESTSUB_PATH}/log/ directory exists.

Functions

Link copied to clipboard

Builds the absolute path of the final parameterized log file (no subfolder).

Link copied to clipboard

Ensures that the log directory exists under NEWBESTSUB_PATH/log/ and returns its absolute path with a trailing path separator.

Link copied to clipboard

Returns the absolute path of the bootstrap log file used from program start, before parameters are known. Ensures the log directory exists.

Link copied to clipboard
fun promoteBootstrapToParameterizedLog(paramsToken: String, desiredRootLevel: Level? = null)

Promotes the bootstrap log to the final parameterized log:

Link copied to clipboard
fun switchActiveLogFile(newAbsoluteBasePath: String)

Switches the active Log4j2 file appender to write to newAbsoluteBasePath.

Link copied to clipboard
fun updateRootLoggerLevel(level: Level): Logger

Updates the root logger level and refreshes all loggers in the current context.