The following fundamental differences exist between Log4Qt and Log4j:
- As a JAVA package Log4j does not have to manage object ownership and lifetime in the same way then it is required in C++. For details on how object ownership is handled see Object ownership.
- The package uses itself for its internal logging similar to Log4j 1.3. For details see Logging within the package.
- The configuration using system properties was replaced with a combination of environment variables and application settings. For details see Environment Variables.
- Custom levels are not supported.
- Multiple Logger Repositories are not supported
The following classes have been changed:
- Configurator
- Configure functions return a boolean indicating, if the configuration was successful.
- Configure errors are accessible over ConfiguratorHelper::configureError().
- Watching for configuration file changes is a function performed centrally by the ConfiguratorHelper. The class provides signals to notify on configuration change and errors.
- The class PropertyConfigurator was extended to be able to read configuration data from a QSettings object.
- LogManager
- A QtMessage handler can be installed via setHandleQtMessages(), to redirect all messages created by calls to qDebug(), qWarning(), qCritical() and qFatal() to a logger. The logger is named Qt and can be accessed using qtLogger().
- The initialisation procedure is available over a public method (startup()).
- The LogManager provides access to the logger used internally by the package (logLogger()) and to its default initialisation procedure (configureLogLogger()).
The following classes have been added:
- An additional appender class, DebugAppender, was added. The class appends logging events to the platform specific debug output.
- Various helper class have been introduced:
- ClassLogger: The class ClassLogger provides logging for a QObject derived class.
- ConfiguratorHelper: The class ConfiguratorHelper provides a configuration file watch and last error for configurator classes.
- DateTime: The class DateTime provides extended functionality for QDateTime.
- LogError: The class LogError represents an error.
- Factory: The class Factory provides factories for Appender, Filter and Layout objects.
- InitialisationHelper: The class InitialisationHelper performs static initialisation tasks.
- LogObject: The class LogObject is the common base class for many classes in the package.
- LogObjectPtr: The class LogObjectPtr implements automatic reference counting for LogObject objects.
- PatternFormatter: The class PatternFormatter formats a logging event based on a pattern string.
- Properties: The class Properties implements a JAVA property hash.