SfCoreLoggers Components


SfCoreLoggers components are a set of extensions to the logging framework used but the SmartFrog core. Currently the only extension available is a wrapper for the longging framework Log4J (http://logging.apache.org/log4j/).

How to build

  1. Build the SmartFrog framework by running ant dist in core/smartfrog

  2. Build ant tasks by running ant in core/extras/ant

  3. Build sfCoreLoggers by running ant in core/components/sfcoreloggers

  4. Step 3 creates one jar file in core/components/sfcoreloggers/build/dist/lib. Copy this jar file and the log4j JAR (1.2.8 or later) to core/smartfrog/dist/lib or update the class path for the SmartFrog daemon so that sfcorelogger classes are available at run time.

- Log4j Wrapper

This wrapper redirects all logging statements from the core logging framework to the Log4J logging framework.

Requires Log4J version 1.2.8 or later

Component Description

Attribute NameDescriptionOptional/Mandatory
configuratorFileURI to a properties or xml Log4j configuration file.Optional
configureAndWatchBoolean attribute to enable automatic reload of the configuration file only valid when using a local configuration file, not valid for URL. Default false;Optional
configureAndWatchDelay Period to reload the configuration in milliseconds. Default 90000. Optional
setIniLog4JLoggerLevelBoolean to determine if to set initial Log4J level. Default false.Optional
ignoreSetLogLevelBoolean to ignore setLogLevel method. Default false.Optional

The first three configuration attributes are directly related to the way log4j manages its configuration files. For more details see Log4j documentation.


Logging is one of the basic services that the framework needs and it is therefore initialized as soon as it is possible. To determine the initial configuration for the core logging framework it is necessary to define a value for the property org.smartfrog.sfcore.logging.LogImpl.localLoggerClass in this case with the value org.smartfrog.sfcore.logging.logger.LogToLog4JImpl. This can be done for example using an system environment property or the configuration file default.ini. It is also possible to add more than one logger to the log framework and modifine their configuration at runtime


Configuration example for “default.ini” configuration file:

  1. To select the Log4j wrapper:

    1. org.smartfrog.sfcore.logging.LogImpl.localLoggerClass=org.smartfrog.sfcore.logging.logger.LogToLog4JImpl

  1. To configure the Log4j wrapper:

    1. org.smartfrog.sfcore.logging.logger.LogToLog4JImpl.configuratorFile=d:\\log4jj.xml

    2. org.smartfrog.sfcore.logging.logger.LogToLog4JImpl.configureAndWatch=true

    3. org.smartfrog.sfcore.logging.logger.LogToLog4JImpl.configureAndWatchDelay=90000