PGX 21.1.1


PGX Uses Slf4j and Log4j

Internally, PGX logs against the slf4j interface and provides log4j as default slf4j implementation.

Configure Log4j

There is a default log4j configuration located in $PGX_HOME/conf/log4j2.xml. This configuration file is picked up automatically by the PGX shell. To use this configuration in your java application, you can set the log4j.configurationFile system variable when launching the JVM:

java -Dlog4j.configurationFile=$PGX_HOME/conf/log4j2.xml ...

See the log4j configuration documentation for more details.

Changing Logging Level During a Shell Session

In the PGX shell, you can use the loglevel(String loggerName, String levelName) function to quickly change the logging level of any logger. Examples:

loglevel("oracle.pgx", "debug")
loglevel("ROOT", "info")
loglevel("org.apache.hadoop", "off")

Changing Slf4j Implementation

You can replace the log4j JARs in $PGX_HOME/third-party with your own slf4j implementation. Just place it in $PGX_HOME/third-party and it will get wild-card included when the PGX Shell is started.

Logging and the PGX Webapp

The PGX WAR file in our download package contains a file called log4j2.xml. The file specifies what should be logged in the web application running on the application server of your choice. The file is located in the folder WEB-INF/classes inside the PGX WAR file. Per default we only log errors, but you can change this file if you want more logging in your webserver. You might have to restart the webserver after you have changed the file, in order to have the change take effect.