Question & Answer
Question
How do I obtain trace information from my Java program using the Toolbox?
Answer
Turn tracing on by doing the following inside of your Jav a program near the beginning of execution:
Trace.setTraceOn(true);
Trace.setTraceDiagnosticOn(true);
Trace.setTraceInformationOn(true);
Trace.setTraceWarningOn(true);
Trace.setTraceErrorOn(true);
Trace.setTraceDatastreamOn(true);
Trace.setTraceThread(true);
Trace.setTraceJDBCOn(true);
**Trace JDBC method available starting in V5R1**
OR
Trace.setTraceAllOn(true);
This will enable tracing and then enable tracing for each individual trace category. Each trace category is described below:
- DATASTREAM
This category is used by Toolbox classes to log data flow between the local host and the remote system. It is not intended for use by classes that use Toolbox classes. - DIAGNOSTIC
This category is used to log object state information. - ERROR
This category is used to log errors that cause an exception. - INFORMATION
This category is used to track the flow of control through the code. - WARNING
This category is used to log errors that are recoverable. - CONVERSION
This category is used by Toolbox classes to log character set conversions between Unicode and native code pages. It is not intended for use by classes that use Toolbox classes. - THREAD
This category is used to log thread information.
OR
Set the following Java system properties:
- com.ibm.as400.access.Trace.category
- com.ibm.as400.access.Trace.file
For example:
java
-Dcom.ibm.as400.access.Trace.category=error,warning,diagnostic
-Dcom.ibm.as400.access.Trace.file=/tmp/toolboxTrace.txt (If the Trace.file property isn't set, the output will go to "standard output".)
Note: The caller can enable or disable specific trace categories (by default all trace categories are disabled). Enabling or disabling one category does not affect other categories. When submitting problems, please enable all trace categories.
NOTE : If you are using JDBC, you will need to turn JDBC tracing on. This will trace JDBC configuration and execution information, which includes any exception stack traces. The easiest way to do this is to add " ;trace=true " to the end of your URL. In V5R1 you can also use the Trace.setTraceJDBCOn(true) method to turn JDBC tracing on.
Product Synonym
IBM i;AS400
Was this topic helpful?
Document Information
Modified date:
05 March 2020
UID
ibm11117275