Difference between revisions of "Debug"

From LongJump Support Wiki
imported>Aeric
imported>Aeric
Line 9: Line 9:


'''Syntax'''
'''Syntax'''
:{|
:<syntaxhighlight lang="java" enclose="div">
<pre>void = Functions.debug(String message)</pre>
void = Functions.debug(String message);
|}
</syntaxhighlight>


'''Return'''
'''Return'''
Line 30: Line 30:


int resultCode = result.getCode();
int resultCode = result.getCode();
Functions.debug(" Result code is " + resultCode);
Functions.debug(" Result code is " + resultCode);


Line 44: Line 43:
else  
else  
{
{
// Take other actions on successful addition  
    // Take other actions on successful addition of the account.
// of the account.
}
}
</syntaxhighlight>
</syntaxhighlight>

Revision as of 00:02, 4 October 2011

Functions.debug(Object obj)
Description
Puts a debug statement into the debug log for Object obj.
Parameters
obj - An object or a String.

Logs a debug message.
View debug messages in the Debug Log.

Syntax

void = Functions.debug(String message);

Return None

Example
This example calls debug after calling updateRecord to log the result code. The code also calls debug to log the message if the result code is less than zero (0).
Parameters params = Functions.getParametersInstance();
String accountID = "";

// Some logic to populate accountID variable.

params.add("name", "Acme Solutions");
params.add("number", "GRG2323339");

Result result = Functions.updateRecord("ACCOUNT", accountID, params);

int resultCode = result.getCode();
Functions.debug(" Result code is " + resultCode);

if(resultCode < 0)
{
    Functions.debug(" Result message is " + result.getMessage());

    // Some error happened.
    String msg = "Account could not be updated";
    Functions.debug(msg + ":\n" + result.getMessage());  // Log details
    Functions.throwError(msg + ".");                     // Error dialog
}
else 
{
    // Take other actions on successful addition of the account.
}