Using client-side logging

Note

For logging specific to pooling, see Using pooling logging.

It may also be helpful to view server-side logs. See Using server-side logging.

You can enable client-side logging either by setting values in the xfNetLink Java properties file (e.g., xfNetLnk.ini) or by calling a method in one of the classes in your JAR file.

Two levels of client-side logging are available: full and error-only. In a production environment, we recommend that you enable error-only logging. Full logging can be useful during development, but we do not recommend it for production.

Client-side logging for xfNetLink Java produces two files, logfilename.log and logfilenameJCW.log, where logfilename is a name you specify. The file logfilename.log contains the complete packets sent back and forth between the Java application and xfServerPlus, while logfilenameJCW.log contains the methods called and their input and output parameters. Most exceptions are written to logfilename.log, but some may go to logfilenameJCW.log, depending on where the exception occurs.

We recommend that you always direct logging output to a file by specifying a log filename. By default, packet information is output to stderr, but method and parameter information is not, which means it cannot be seen unless it is written to file.

Note

If your client application is not attached to a terminal (e.g., JavaServer Pages), output to stderr will not be visible; you must use the xf_LogFile property to write it to file.

If the log file does not exist, it will be created; if it already exists, additional information will be appended to the end.

Note that if encryption is enabled, the log displays a string of 10 asterisks instead of the packet data for encrypted methods.

To enable logging in the properties file

All processes will write to the same file. See Specifying logging options for more information on using properties file settings.

To enable logging by calling a method

The log files will contain data only for the class from which they are called.

For example, to enable error-only logging,

xfTest instance = new xfTest();
  instance.setxfLogging(true);     // turn on logging
  instance.setxfExceptOnly(true);  // log exceptions only
  instance.setxfLogfile("c:\\myDir\\logName.log"); 

Sample log files

If full logging is enabled, the packet output (logfilename.log) shows the IP address that SWPConnect is listening on, the current time-out settings, the packets sent and received, and any exceptions that occur. If error-only logging is enabled, the session start-up information displays, followed by exceptions.

As shown in the sample below, connection information prints once for each session; sent and received data prints for each call to xfServerPlus.

---------------------------------------
SynergyWebProxy session beginning: July 13, 2014 10:15:18 AM PST
Local host: tiger/111.22.33.44
Request timeout = 120 seconds
Connect timeout = 600 seconds
Communicate timeout = 1800 seconds
---------------------------------------
Sending string:
Jcompid0009;2;AL5#abcde;AL5#54321;
Received string:
Rcompid0009;03;00AL9#Return   ;01AL5#back1;02AL5#back2;
Sending string:
Jcompid0010;2;AL5#abcde;AL5#54321;
Received string:
Rcompid0010;02;00DE9#123456789;02AL5#back ; 

If full logging is enabled, the method and parameter output (logfilenameJCW.log) shows the IP address, followed by each method called with its input and output parameters, and may include exceptions as well. If error-only logging is enabled, the session start-up information displays followed by any exceptions. The parameter information includes the Java data type, parameter name, and the data in the parameter.

SynergyWebProxy session beginning: July 13, 2014 11:35:02 AM PST
Local host: tiger/111.22.33.44
 ** In method: function_one
  * Input parameters
     String p1 =This is an Alpha field 50 characters long a test
     long p2 = 12345
     double p3 = 1234567.911
     int p4 = 12345
  * Output parameters
 ** In method: function_two
  * Input parameters
     DoubleHolder p1 = 1.23456789012E9
     DoubleHolder p2 = 12345.6789
     double p3 = 12345.6789
     double p4 = 1.234567891E7
     long p5 = 1234567890
     DoubleHolder p6 = 0.123456
     double p7 = 1.2345
     LongHolder p8 = 12345678
     DoubleHolder p9 = 123456.7
     long p10 = 123456789
  * Output parameters
     DoubleHolder p1 = -1.23456789112E9
     DoubleHolder p2 = 333.334
     DoubleHolder p6 = 0.9988332
     LongHolder p8 = -88991010
     DoubleHolder p9 = 654321.0