You have been asked to examine the log files for errors generated by the HRApps application. To practice reading the log files, create a test message and add the message to the PEGA log.
The following table provides the credentials you need to complete the exercise.
|Senior System Architect||SSA@TGB||rules|
Create an activity that uses the Log-Message method to write a message to the PegaRULES log file. Apply the activity to the Identify_Employee_0 flow action for the EmployeeEvaluation case type as a post-processing action. Then, view the log file generated by the Pega server to locate your message.
1 Create an activity to add a message to the log file
In the EmployeeEvaluation class, create an activity record named WriteToLog.To create an activity record, in the Application Explorer, right-click the class name and select Create > Technical > Activity.
- In the first step of the activity, in the Method field, select Log-Message.
- Expand the method parameters.
- In the Message field, enter "Test message".
In the LoggingLevel field, enter InfoForced.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.
Save the activity.Justify the warnings before check-in, as activity is the only rule type to write error message in the log file.
In the Employee Evaluation class, open the IdentifyEmployee_0 flow action.Flow action records are located in the Process category in the Application Explorer.
- Click the Action tab.
- 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.
- Save the flow action to commit your configuration change.
- Create a new Employee Evaluation case and complete the Identify Employee form to generate an entry in the PEGA log.
2 Confirm your work
- In Dev Studio, select Configure > System > Operations > Logs to open the System: Operations landing page.
- Under Log utilities, click Log files. The log viewer opens in a new browser window, listing the log files written by your server.
Under File (click to view), click the log file for the PEGA Appender File to open the log within the window.For security reasons, the option to download log files is not available in your exercise environment.
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.If your log file lists more than one entry, locate the entry with the most recent timestamp.
- Click Options to view the display options for the log file.
Clear the contents of the Filter by field to display all log events.
- Click Apply to refresh the contents of the log viewer.
- Above the Options link, click the last page of results and locate your message.
- Close the window containing the log file.
- Return to the IdentifyEmployee_0 flow action and remove the activity from the Post-processing section of the Actions tab.
Save the flow action to prevent the application from writing your test message to the PEGA log.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.