Logging

Overview of CASClient Logging

The CASClient class that is used to connect to SAS Cloud Analytic Services and run actions uses the java.util.Logger utility. You can enable logging from your Java application through the standard java.util.Logger configuration or with Java system properties.

Logging with a Configuration File

A sample java.util.Logger configuration file is as follows:

Sample logging.properties File
handlers=java.util.logging.ConsoleHandler
com.sas.cas.level=FINE
java.util.logging.ConsoleHandler.level=ALL

Specify the path to the file with the java.util.logging.config.file system property when you start your application:

-Djava.util.logging.config.file=/path/to/logging.properties

Logging with the Java System Property

Another way to enable logging is to specify the partial or full package name to enable as a system property when you start your application:

-Dcom.sas.cas.debug=true

Logging can be written to a file by specifying a system property too:

-Dcom.sas.cas.debug.file=/tmp/my.out

Logging File Format

The default logging format can be overridden using the standard logging system property java.util.logging.SimpleFormatter.format:

-Djava.util.logging.SimpleFormatter.format="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL %4$-6s %2$s %5$s%6$s%n"

For information about the format string syntax, see the Java documentation for the java.util.Formatter class. The Java 8 documentation is available at the following URL, but is subject to change.

https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html

Last updated: May 26, 2018