getConfiguration

open override fun getConfiguration(loggerContext: LoggerContext, source: ConfigurationSource): Configuration

Depending on whether this is the first run of ServerPackCreator on a users machine, the default log4j2 configuration may be present at different locations. The default one is the config inside the home-directory of SPC, of which we will try to set up our logging with. If said file fails for whatever reason, we will try to use a config inside the directory from which SPC was executed. Should that fail, too, the config from the classpath is used, to ensure we always have default configs available. Should that fail, too, though, log4j is set up with its own default settings.

Return

Custom configuration with proper logs-directory set.

Author

Griefed

Parameters

loggerContext

logger context passed from log4j itself

source

configuration source passed from log4j itself. Attempts to overwrite it are made, but if all else fails it is used to set up logging with log4j's default config.