Logging API

From PhexWiki

Jump to: navigation, search

The Phex logging concept can be configured to support different type of logging libraries. It's using the Apache Commons Logging API as a bridge between different common logging libraries.

Contents

Logging Configuration

General Configuration

To configure the Phex logging, you need to create a file called logging.properties inside your Phex configuration directory.

To configure the log instance you need to add a property called org.apache.commons.logging.Log. The property can have the following values:

  • org.apache.commons.logging.impl.Log4JLogger
    For use of Log4j as a logging library.
  • phex.utils.PhexLogger
    This is the default logger for Phex.
  • org.apache.commons.logging.impl.Jdk14Logger
    For use of the JDK logging library.
  • org.apache.commons.logging.impl.SimpleLog
    To use a simple log instance of Commons Logging.


Log4J Configuration

When using org.apache.commons.logging.impl.Log4JLogger you can use the following additional properties:

  • log4j.configuration
    File path possible with URL (file:/c%3A/MyFiles/phex/log4j.properties)


Phex Logging Configuration

When using phex.utils.PhexLogger you can use the following additional properties:

  • phex.utils.logger.logFile = phex.log
  • phex.utils.logger.errorLogFile = phex.error.log
  • phex.utils.logger.level = 3
  • phex.utils.logger.console = false
  • phex.utils.logger.maxFileSize = 524288


Commons Logging Configuration

When using org.apache.commons.logging.impl.SimpleLog you can use the following additional properties:

  • org.apache.commons.logging.simplelog.defaultlog
    Default logging detail level for all instances of SimpleLog. Must be one of ("trace", "debug", "info", "warn", "error", or "fatal"). If not specified, defaults to "info".
  • org.apache.commons.logging.simplelog.log.xxxxx
    Logging detail level for a SimpleLog instance named "xxxxx". Must be one of ("trace", "debug", "info", "warn", "error", or "fatal"). If not specified, the default logging detail level is used.
  • org.apache.commons.logging.simplelog.showlogname
    Set to true if you want the Log instance name to be included in output messages. Defaults to false.
  • org.apache.commons.logging.simplelog.showShortLogname
    Set to true if you want the last component of the name to be included in output messages. Defaults to true.
  • org.apache.commons.logging.simplelog.showdatetime
    Set to true if you want the current date and time to be included in output messages. Default is false.
  • org.apache.commons.logging.simplelog.dateTimeFormat
    The date and time format to be used in the output messages. The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. If the format is not specified or is invalid, the default format is used. The default format is yyyy/MM/dd HH:mm:ss:SSS zzz.
number-child
SourceForge.net Logo

Please visit our supporters
Amazon.com or Amazon.de