Platform SDK Java 9.0 API Reference

Package com.genesyslab.platform.commons.log

This package provides logging support for your applications.

To turn on internal logging in the Platform SDK, you have to set up a logger implementation in the Log class BEFORE making any other calls to the Platform SDK. There are two ways to do this:

Starting from Platform SDK version 8.5.1 there are several built-in implementations of the PSDK Commons Logging interface beside previously existing Log4j (version 1.2). There are adaptors for java.util.logging, Slf4j, Log4j 2.x, and simple console output logger.
When particular logging framework adaptor is enabled, all the logging configuration like logging levels, log files management, other logging targets, etc are to be configured in the selected framework.
For example, in case of usage of Log4j v1.2 (with old adaptor com.genesyslab.platform.commons.log.Log4JLoggerFactoryImpl), you will need to configure log4j according to your logging needs. A simple log4j configuration file follows:


log4j.logger.com.genesyslab.platform=DEBUG, A1
log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1.file=psdk.log
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %-25.25c %x - %m%n

To use more powerful Log4j v2.x framework, it is possible to setup correspondent adaptor - com.genesyslab.platform.commons.log.Log4J2LoggerFactoryImpl (alias name "log4j2") with:

Sample Log4j 2 configuration file (log4j2.xml) may look like:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn">
  <Appenders>
    <File name="MyFile" fileName="logs/psdk.log">
      <PatternLayout>
        <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
      </PatternLayout>
    </File>
    <Async name="Async">
      <AppenderRef ref="MyFile"/>
    </Async>
  </Appenders>
  <Loggers>
    <Root level="error">
      <AppenderRef ref="Async"/>
    </Root>
  </Loggers>
</Configuration>

For general information on the structure and usage of the Platform SDKs, please refer to the introductory pages at the beginning of this guide.

Skip navigation links
Platform SDK Java 9.0 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 9.0.006.00
Copyright © 2006–2019 Genesys Telecommunications Laboratories, Inc. All rights reserved.