7.12 Logging and Debugging

The following sections show some examples how jobs can be logged and debugged:

7.12.1 Creating a Job Memo

This job example shows how to set a brief memo visible in the Orchestrator console.

In the job section of this example (lines 4-8), the fact name (jobinstance.memo) is set by job instance.


1  JOB:
2  fact name "jobinstance.memo"
3 
4  class MyJob(Job):
5     def job_started_event(self):
6         numJoblets = 2
7          self.setFact("jobinstance.memo", "Running MyJob Scheduling + " + numJoblets + " joblets")
8         self.schedule(MyJoblet,numJoblets)

In the joblet section of this example, the face name (joblet.memo, line 10), is set by the joblet instance and consists of a brief memo for each joblet. This typically is used for providing detailed explanations, such as what executable is being run.


9  JOBLET:
10 fact name "joblet.memo"  (Set by joblet instance) 
11

In lines 12-19, the name of the joblet is specified. This is typically a simple word, which is displayed in the console joblet column view.


12 fact name "joblet.instancename" 
13
14
15 class MyJoblet(Joblet):
16    def joblet_started_event(self):
17         self.setFact("joblet.memo", "Running MyJoblet on " + self.getFact("resource.id"))
18
19         self.setFact("joblet.instancename", "webserver")

Figure 7-1 Example of How a ‘logexample’ Name Appears in the Orchestrator Console

7.12.2 Tracing

There are two facts on the job grid object to turn on /off tracing. The tracing fact writes a message to the job log when a job and/or joblet event is entered and exited.The facts are job.tracing and job.joblet.tracing. You can turn these on via the Orchestrator console or from the zos run command tool.