Skip to main content

Challenge

Reviewing log files

2 Tasks

15 mins

Visible to all users
Intermediate Pega Platform 8.6 Enterprise Application Development Performance English

Scenario

During the employee evaluation process, employees undergo an evaluation period to regularly assess their performance as new hires. To check the status of the evaluation period in the employee evaluation case type, the IsEvalPeriodEnded when rule checks if the entered evaluation date has passed. If the date entered by the user is within the evaluation period, the case moves to the next process of Assess employee. When the user enters a future date outside the evaluation period, the Assessment step is skipped, and the case moves to the Review stage.

While the correct syntax to evaluate the When condition for skipping the Assess employee process should read "Invalid Evaluation End date + .Enddate," a developer has misspelled the property as ".Emddate." At runtime, you notice the process is not returning the expected values. Review the log to discover this discrepancy. 

  • Consider a scenario where the developer has created a new Property named Emddate
  • In the Existing when condition IsEvalPeriodEnded the developer has misspelled EndDate as Emddate
  • Create an activity that uses the Log-Message method to write a message to the PegaRULES log file only when the IsEvalPeriodEnded returns true
  • Add this activity in the Run activity field under the Actions tab in the IdentifyAssessmentPeriod_0 flow action.
  • Run the case and view the log file generated to see the message "Invalid Evaluation criteria End date"+ .Enddate

The following table provides the credentials you need to complete the challenge.

Role User name Password
Senior System Architect SSA@TGB rules
Note: Your practice environment may support the completion of multiple challenges. As a result, the configuration shown in the challenge walkthrough may not match your environment exactly.

Challenge Walkthrough

You must initiate your own Pega instance to complete this Challenge.

Initialization may take up to 5 minutes so please be patient.

Detailed Tasks

1 Introduce the misspelled property

  1.  In the EmployeeEvaluation class, create a property Emddate of Date type.

    Emd date property

     

  2. In the same class, Open the existing when rule named IsEvalPeriodEnded and modify the End date with Emddate

    When

2 Create an activity to add a message to the log file

  1. In the EmployeeEvaluation class, create an activity record named WriteToLog.

    Tip: To create an activity record, in the Application Explorer, right-click the class name and select Create > Technical > Activity.
  2. In the first step of the activity, add an Enable when condition, and then set the following values: When IsEvalPeriodEnded, if true Skip Step ,if false Continue Whens 
    Method
     
  3. In the Method field, enter or select Log-Message.
  4. In the Message field, enter "Invalid Evaluation criteria End date" + .Emddate
  5. In the LoggingLevel field, enter InfoForced.

    message
    Note: By default, the PegaRULES log only records messages with the logging level set to Error. Setting the level to InfoForced overrides this limitation without changing the logging level setting for the server.
  6. Save the activity.

    Note: Justify the Guardrail warnings before check-in, as creating a new Activity will prompt warnings.
  7. In the Employee Evaluation class, open the IdentifyAssessmentPeriod_0 flow action.

    Tip: Flow action records are located in the Process category in the Application Explorer.
  8. Click the Action tab.
  9. In the Post-processing section of the Action tab, in the Run activity field, enter or select WriteToLog to add your activity to the flow action as a post-processing action.
  10. Save the flow action to commit your configuration change.

Confirm your work

  1. Create a new Employee Evaluation case, and then complete the Identify Employee form and Submit.
  2. Proceed to the Identify Assessment form, and enter a valid End date.
  3. Verify the case moves to the Review stage instead of giving the valid Evaluation dates 
    valid dates
  4. To troubleshoot and see the issue Login to Dev Studio, select Configure > System > Operations > Logs to open the System: Operations landing page.
  5. Under Log utilities, click Log files. The log viewer opens in a new browser window, listing the log files written by your server.
  6. Under File (click to view), click the log file for the PEGA Appender File to open the log within the window.

    Note: For security reasons, the option to download log files is not available in your exercise environment.
  7. In the log file, locate the most recent entry. Confirm that the entry matches the logging level and message from the activity you created earlier in the exercise. This log message entry happens only when the IsEvalPeriodEnded rule returns false:

    message1
    Note: If your log file lists more than one entry, locate the entry with the most recent timestamp.
  8. Close the window containing the log file.
  9. You can then return to the When rule and confirm that the Property has been misspelled.
  10. Return to IsEvalPeriodEnded When condition, replace the misspelled Emddate with EndDate property
  11. Complete steps 1-2 and confirm the view contains the valid evaluation dates. 
  12. Return to the IdentifyAssessmentPeriod_0  flow action and remove the activity from the Post-processing section of the Actions tab.
  13. Save the flow action to prevent the application from writing your test message to the PEGA log.

    Tip: To reduce clutter in the Pega log and improve performance, remove activity steps that write InfoForced level messages or convert them to comments when the message is no longer needed.


Available in the following mission:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice