Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

Without any explicit specification on the command line or in the install.xml itself, an installer logs to the console at the given log level. For this purpose it associates a default Java ConsoleHandler combined with a built-in formatter not being that messy like the JRE's SimpleFormatter. The log level to limit the output to depends on whether you set IzPack to debug mode by adding the command line option -debug (or the -DDEBUG=true JVM option for IzPack versions < 5.1.0). If the installer runs in debug mode the Java Logging level for the root logger is set to FINE by default globally, by default it is INFO otherwise.

...

Beyond the built-in logging mechanisms for console and file output there can be override the Java Logging configuration, handlers, formatters and their configuration at each desired Java package hierarchy you may add to an external configuration file, which can be passed as JVM command line option (standard approach of the LogManager API) or at compile time in the installer descriptor.

...

Code Block
languagexml
titleSyntax
<logging>
  <log-file pattern="${logging.file}" append="true" ... />
</logging>

The <logging> element accepts the following attributes:

Attribute nameDescriptionAllowed valuesDefault
level

Specifies the global logging level for console logging.
In general there are logged just messages with the same or higher priority than the level specified.
The level SEVERE has the highest priority, FINEST the lowest one.

The value OFF mutes the output to the console.

OFF | SEVERE | WARNING | INFO | CONFIG | FINE | FINER | FINEST | ALL

INFO


The above definition of a <log-file> supports all configuration options of java.util.logging.FileHandler as attributes, in particular:

Attribute nameDescriptionAllowed valuesDefault

pattern

Pattern for generating the output file name.
See the FileHandler API for details on how a pattern can be designed.
IzPack variables are resolved.
The parent directory of the log file must exist, otherwise the installer will fail.
The log file will be created automatically if it doesn't exist at the time the first log entry should be written.

Info

According to the FileHandler API the percent '%' sign is used as an escape character for different special components that will be replaced at runtime. If you want to user a percent sign as static part of the path name use a double percent sign ("%%") to get it to that place in the name.

Valid path to log file name.
The file name is normalized as much as possible. 
%h/java%u.log
level

Specifies the logging level.
In general there are logged just messages with the same or higher priority than the level specified.
The level SEVERE has the highest priority, FINEST the lowest one. 

This level overrides the global level defined above.

Example: If the global logging level is set to OFF and the file logging level to INFO, the installer logs just to the file.

OFF | SEVERE | WARNING | INFO | CONFIG | FINE | FINER | FINEST | ALL

INFO
filterSpecifies the name of a Filter class to use (defaults to no Filter).Fully qualified Java class name.(no filter)
encodingThe name of the character set encoding to use.Valid Java character set name.
Example: like UTF-8
(platform encoding)
limitSpecifies an approximate maximum amount to write (in bytes) to any one file.
If this is zero, then there is no limit.
Integer value >= 0(no limit)
countSpecifies how many output files to cycle through.
This allows you to maintain a limited number of log file archives with a maximum size specified by the limit attribute (rolling log files). 
Integer value >= 11
appendSpecifies whether the FileHandler should append onto any existing files.true | falsefalse
mkdirs

Specifies whether the installer should recursively create the parent directory of the log file speciified by the pattern attribute.

Info

This attribute is not part of the FileHandler API and is hidden to the FileHandler configuration. IzPack handles it before the according FileHandler-based Java Logger gets activated.

true | falsefalse

...

You can also log to files, sockets and other resources, see the appropriate handler implementation and their dedicated configuration for more details.

...