Showing posts with label Logging. Show all posts
Showing posts with label Logging. Show all posts

Saturday, 26 September 2026

Troubleshooting Oracle Time and Labor: How to Enable Logging & Trace Time Calculation Rules in Oracle Cloud HCM

In Oracle Cloud Time and Labor (OTL), tracking down why a time calculation rule or validation rule produced unexpected results can be challenging when viewing only the final time card lines. Because OTL processes entries in bulk arrays, determining which condition, limit, or threshold triggered an outcome requires visibility into runtime execution.

Oracle delivers a dedicated diagnostic framework for this: the Analyze Rule Processing Details task. By configuring profile option ORA_HWM_RULES_LOG, instrumenting Fast Formulas with add_rlog(), validating security profiles, and managing log retention via ORA_HWM_RULES_LOG_MONTHS_TO_KEEP, administrators can review rule execution logs, formulas, and rule set processing details to diagnose issues effectively.

📌 Oracle Documentation Technical Profile

Diagnostic Task Analyze Rule Processing Details
Task Navigation My Client Groups > Time Management > Tasks panel > Analyze Rule Processing Details
Logging Activation Profile ORA_HWM_RULES_LOG
Supported Log Levels Incident, Finest, Finer, Fine
Log Retention Profile ORA_HWM_RULES_LOG_MONTHS_TO_KEEP (0 to 24 Months)
Required Job Role Time and Labor Administrator (ORA_HXT_TIME_AND_LABOR_ADMINISTRATOR_JOB)

1. Enabling Processing Logs (ORA_HWM_RULES_LOG)

Because logging every rule evaluation generates significant I/O activity, processing logs are disabled by default. You enable them using the administrator profile option ORA_HWM_RULES_LOG.

Navigation: Setup and Maintenance > Tasks panel > Search > Manage Administrator Profile Values

  1. Sign in as an application administrator.
  2. Search for and select the ORA_HWM_RULES_LOG profile option code.
  3. Select the appropriate profile value based on the level of granularity required:
Log Level Rule Set Logs Rules Log
Incident No, unless status is Failed No, unless status is Failed
Finest Yes Yes
Finer Yes Yes for time calculation and entry rules
No for workforce compliance rules
Fine Yes for time calculation and entry rule sets
No for workforce compliance rule sets
No

2. Confirming Security Profiles for Analyze Rule Processing Details

Before an administrator can view rule set and rule processing details, their sign-in credentials must have the proper data role and security profile assignments.

Verification Step: Navigate to My Client Groups > Time Management > Tasks panel > Analyze Rule Processing Details

In the Search section, open the Worker list:

  • If the Worker list is empty: The data role is missing or incorrectly configured.
  • If the Worker list shows values: Your security is configured properly to view logs.

Setting Up Security (If the Worker List is Empty)

  1. Go to Setup and Maintenance > Tasks panel > Search > Manage Data Role and Security Profiles.
  2. Create a data role based on Job Role Time and Labor Administrator (Role Code: ORA_HXT_TIME_AND_LABOR_ADMINISTRATOR_JOB).
  3. On the Security Criteria page, ensure you select View All across security profiles:
    • In Organization Security Profile, select View All Organizations.
    • In Position Security Profile, select View All Positions.
    • In LDG Security Profile, select View All Legislative Data Groups.
    • In Person Security Profile, select View all People (do not select View all Workers).
  4. Submit the data role, assign it to the administrator user account under Manage Job Roles, sign out, and sign back in.

3. Fast Formula Code: Adding Logs via add_rlog

Delivered formulas and custom Fast Formulas (such as Time Calculation and Time Entry rules) write diagnostic entries to the execution log using the internal function add_rlog().

To enable add_rlog, extract the two mandatory contexts HWM_FFS_ID and HWM_RULE_ID immediately after the INPUTS block, and wrap all numeric or date variables in TO_CHAR():

Fast Formula Code Snippet: Adding Diagnostic Logs via add_rlog
/* ----------------------------------------------------------------------
 * 1. MANDATORY CONTEXT HOOKS
 * Must be declared immediately after the INPUTS statement
 * ---------------------------------------------------------------------- */
ffs_id  = GET_CONTEXT(HWM_FFS_ID, 0)
rule_id = GET_CONTEXT(HWM_RULE_ID, 0)
ffName  = 'XXGEN_US_CA_STRAIGHT_TIME_FF'

/* Trace entry into the formula */
rLog = add_rlog(ffs_id, rule_id, '>>> Enter - ' || ffName)

/* ----------------------------------------------------------------------
 * 2. LOGGING HEADER & CONTEXT VARIABLES
 * Always wrap numeric and date variables with TO_CHAR()
 * ---------------------------------------------------------------------- */
rLog = add_rlog(ffs_id, rule_id, 
         'Header Resolved | Start: ' || TO_CHAR(aiStartTime) || 
         ' | End: ' || TO_CHAR(aiStopTime) || 
         ' | Weekly Sched Limit: ' || TO_CHAR(weekly_sch_hrs))

/* ----------------------------------------------------------------------
 * 3. LOGGING INSIDE ARRAY LOOPS
 * Output values as each time card line is evaluated
 * ---------------------------------------------------------------------- */
WHILE (nidx < wMaAry) LOOP (
  nidx          = nidx + 1
  aiRecPosition = HWM_CTXARY_RECORD_POSITIONS[nidx]
  tcMeasure     = MEASURE[nidx]
  aiPTT         = PayrollTimeType[nidx]

  rLog = add_rlog(ffs_id, rule_id, 
           'Row ' || TO_CHAR(nidx) || 
           ' | Pos: ' || aiRecPosition || 
           ' | Type: ' || aiPTT || 
           ' | Hours: ' || TO_CHAR(tcMeasure))

  /* Log conditional threshold branches */
  IF (aiRecPosition = 'DETAIL' AND aiPTT = 'Regular Hours') THEN (
    calc_reg_hours_wk = calc_reg_hours_wk + tcMeasure
    
    IF (calc_reg_hours_wk > weekly_sch_hrs) THEN (
      st_time_cur = calc_reg_hours_wk - weekly_sch_hrs
      rLog = add_rlog(ffs_id, rule_id, 
               '--> Threshold Exceeded! Straight Time Split: ' || TO_CHAR(st_time_cur))
    )
  )
)

/* ----------------------------------------------------------------------
 * 4. LOGGING OUTPUT RESULTS & EXIT
 * ---------------------------------------------------------------------- */
rLog = add_rlog(ffs_id, rule_id, 
         'Final Allocation | Straight Time: ' || TO_CHAR(st_time) || 
         ' | Unpaid Deficit: ' || TO_CHAR(unpaid_time))

rLog = add_rlog(ffs_id, rule_id, '<<< Exit - ' || ffName)

4. Diagnosing Issues via Analyze Rule Processing Details

Once logging is enabled, security is verified, and a test time card is submitted or saved, open the diagnostic console to trace execution:

  1. Navigate to My Client Groups > Time Management > Tasks panel > Analyze Rule Processing Details.
  2. Search for the employee and period in question.
  3. Inspect execution using the four dedicated diagnostic buttons:
    • Rule Definition: View details of the rule configuration, including parameter inputs and expected outputs.
    • Rule Processing Log: Review the granular execution log for the specific rule to diagnose formula evaluation issues and custom add_rlog trace entries.
    • Rule Set Processing Log: Review the overall processing log for the rule set to see rule execution sequencing and set-level status.
    • Formula Details: View details of the Fast Formula associated with the rule template.
  4. Correct any identified issues using the relevant setup tasks (such as Rule Templates, Rules, or Rule Sets).

Sample Rule Processing Log Output

Diagnostic Trace: XXGEN_US_CA_STRAIGHT_TIME_RULE Status: Completed
[INFO]  Rule Set Name: XX_US_CA_WEEKLY_CALC_RULE_SET
[INFO]  Executing Rule: XXGEN_US_CA_STRAIGHT_TIME_RULE (Order: 1)
---------------------------------------------------------------------------------------------------
[TRACE] >>> Enter - XXGEN_US_CA_STRAIGHT_TIME_FF
[TRACE] Header Resolved | Start: 2026-09-14 00:00:00 | End: 2026-09-20 23:59:59 | Weekly Sched Limit: 37.5
[TRACE] Row 1 | Pos: DETAIL | Type: Regular Hours | Hours: 8.0 | Running Total: 8.0
[TRACE] Row 2 | Pos: DETAIL | Type: Regular Hours | Hours: 8.0 | Running Total: 16.0
[TRACE] Row 3 | Pos: DETAIL | Type: Regular Hours | Hours: 8.0 | Running Total: 24.0
[TRACE] Row 4 | Pos: DETAIL | Type: Regular Hours | Hours: 8.0 | Running Total: 32.0
[TRACE] Row 5 | Pos: DETAIL | Type: Regular Hours | Hours: 8.0 | Running Total: 40.0
[TRACE] --> Threshold Exceeded! Straight Time Split: 2.5
[TRACE] Final Allocation | Straight Time: 2.5 | Unpaid Deficit: 0.0
[TRACE] <<< Exit - XXGEN_US_CA_STRAIGHT_TIME_FF
[INFO]  Rule Execution Completed Successfully. Output arrays returned to OTL Engine.

5. Managing Log Deletions (ORA_HWM_RULES_LOG_MONTHS_TO_KEEP)

Rule and rule set log files consume significant database storage over time. Oracle provides automatic and manual deletion mechanisms to manage log file lifecycle.

Automatic Log Deletions

  1. Navigate to Setup and Maintenance > Tasks panel > Search > Manage Administrator Profile Values.
  2. Search for and select profile option code: ORA_HWM_RULES_LOG_MONTHS_TO_KEEP.
  3. Enter a site-level profile value from 0 to 24 (the number of months to keep log files before automatic deletion):
    • Entering 0 deletes all entries.
    • Logs older than 24 months are automatically deleted by the application; entering any number greater than 24 automatically adjusts to 24.
  4. Click Save and Close.

Manual Log Deletions

To manually purge log files that are older than the retention value set in the profile option but younger than 24 months:

  1. Go to My Client Groups > Time Management > Tasks panel > Analyze Rule Processing Details.
  2. Select Actions > Delete Older Log Files.

🔑 Architectural Best Practices for OTL Diagnostics

  • Select Appropriate Log Level: Use Finest for full rule-level and rule-set-level traces, or Finer when focusing specifically on time calculation and entry rules without workforce compliance noise.
  • Verify Security First: Always verify that the Worker search list in Analyze Rule Processing Details is populated before troubleshooting. If empty, ensure your data role has View all People assigned.
  • Use Dedicated Diagnostic Buttons: Leverage Rule Processing Log, Rule Set Processing Log, and Rule Definition on the Analyze Rule Processing Details page to review execution steps.
  • Control Log Retention: Manage performance by maintaining ORA_HWM_RULES_LOG_MONTHS_TO_KEEP and running Actions > Delete Older Log Files when needed.
Oracle Cloud Time & Labor Architecture Diagnostics & Troubleshooting Guide