The following information is valid for IzPack versions >= 5.0.11, where the logging behavior has been consolidated.
Introduction
IzPack installers use Java Logging for logging any information. If you want to customize it you should be familar with it, otherwise there is a good description of its principles in Oracle's Java Logging Overview.
Unless overridden on the command line, an installer overrides the JVM log settings and logs to the console in a special format, depending on the log level. The log level depends on whether you set IzPack to debug mode by adding the -DDEBUG=true
JVM option. If the installer runs in debug mode the Java Logging level for the installer implementation (package com.izforge.izpack
) is set to FINE by default globally, otherwise INFO.
If the log level results in INFO the log output appears simplified with one line per log entry, for the debug mode there will be shown an enhanced output with class and method names and a timestamp.
You can override Java Logging handler, formatting and log levels for each Java package hierarchy you add to a configuration file, which can be given by the JVM command line option -Djava.util.logging.config.file=<path>
.
Alternatively, there might be used am own custom implementation given as parameter -D
java.util.logging.config.class=<classname>
, which initializes the installer logging in its default constructor. See the LogManager API Specification for more information.
Here is what an example installer logs to the console when without custom logging:
> /usr/java/jdk1.8.0_112/jre/bin/java -jar installer.jar Logging initialized Commandline arguments: Detected platform: suse_linux,version=4.8.13-1-default,arch=x64,symbolicName=null,javaVersion=1.8.0_112
If you wish to add debug information to the log of the IzPack installer implementation you can add the -DDEBUG=true
JVM option, which will result in a very messy output with information for installer developers (shortened):
> /usr/java/jdk1.8.0_112/jre/bin/java -DDEBUG=true -jar installer.jar java.util.logging.LogManager$RootLogger log INFO: Logging initialized com.izforge.izpack.installer.bootstrap.Installer start INFO: Commandline arguments: com.izforge.izpack.core.resource.DefaultLocales getMessagesStream FINE: Locale has no langpack for code: com.izforge.izpack.core.container.PlatformProvider provide INFO: Detected platform: suse_linux,version=4.8.13-1-default,arch=x64,symbolicName=null,javaVersion=1.8.0_112 com.izforge.izpack.core.data.DefaultVariables set FINE: Dynamic variable 'APP_NAME' set to 'My Great Application' ...
Example of log customization using a configuration file
The example here is very simple, just for the purpose to show how the installer handles logging customization.
IzPack uses the following built-in configuration;
If you want to use the default JVM console log handler and formatter instead of the IzPack built-in facilities you might use this configuration file:
You might for example mix both configuration above: