Debugging
You can use ITK debugging aids such as journal files and log files to understand errors in your program.
Journal files
Teamcenter optionally journals the calls to all of the ITK functions. This is in a file(*.jnl) called journal_file after the program is run. This file can be very useful in finding out what your program has done and where it went wrong.
System logs
The system log can be useful in diagnosing errors because when a function returns an error, it often writes extra information to the system log. For example, if your program crashes you may not have an error message, but the end of the system log may show what the program was trying to do just before crashing.
For POM, use the POM_set_env_info function; otherwise, use the
xxx_set_journaling(int flag) function, where flag is equal to 0 (zero) for off or not equal to 0 for on and XXX stands for modue name. You can have ITK and EPM journaling on if you are working in
that area and leave POM and PS journaling off.
Teamcenter Preference for journalling :
TC_Journalling DESCRIPTION: Determines whether calls to the ITK are logged in journal files. The data is written to the program.jnl file. VALID VALUES : ON Enables journalling. OFF Suppresses journalling.Environment Variable for journalling :
TC_JOURNAL (set in the tc_profilevars.bat/.sh file) Controls journalling. Accepts the following values: OFF Creates an empty journal file. SUMMARY Creates a summary report listing the total time spent on each journal routine. FULL Creates a full report listing each call. MODULE Uses the TC_Journal_Modules preference to select which modules should be journalled.
ITK extension rules cannot provide information or warning feedback to users.
For example, if you want a warning dialog box to appear after anoperation is done, you cannot define the warning in ITK extension rule
code because of the code processing order:
1. Teamcenter code is executed.
2. The custom code is executed.
3. Teamcenter code is executed.
For example, you put the following into the extension rule custom code:
EMH_store_error_s2(EMH_severity_warning, ITK_err,
"EMH_severity_warning", "ITK_ok");
return ITK_ok;
You place this code in step 2 because you want the Teamcenter
framework to proceed with step 3 so that when the whole execution is
done, the user receives a warning message in the client.
However, the only errors or warnings returned from a service operation are the ones explicitly returned by the business logic of the service implementation. This is typically done with code like this:
Try
{
}
Catch( IFail& ifail)
{
serviceData.addErrorStack(); // This will add the current
IFail and whatever other errors/warnings are currently on the error store
}
Initializing modules
You must either call the initialization function for all modules, ITK_init_module,or the individual module initialization function, such as FL_init_module, before using any of the functions in that module. If you do not, you get an error like FL_module_not_initialized. The only reason that a module initialization should ever fail is if the module requires a license and there is no license available.You should also remember to exit modules. In some cases this could cause significant memory to be freed. It may also free up a concurrent license for use by another user.
Journaling comment :
Journaling File is Created in temp directory by exename+randomcharacter+.jnlITK api is ITK_set_journalling (TRUE);//enable journaling
JOURNAL_comment("comment goes here");//Actual comment to be written
Teamcenter Preference to enable Journaling is TC_JOURNAL
TC_JOURNAL=FULL or TC_JOURNAL=SUMMARY etc
this should be written in tc_profilevars file to enable journaling
TC_write_syslog :
Statement will be shown in .syslog file created in temp directory
TC_write_syslog api has been used in custom_exit itk program and it's statement can be seen in .syslog file please refer below snap shot.
No comments:
Post a Comment