Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.quartz.plugins.history
Class LoggingJobHistoryPlugin

    java.lang.Object
      org.quartz.plugins.history.LoggingJobHistoryPlugin

All Implemented Interfaces:
  JobListener, SchedulerPlugin

    public class LoggingJobHistoryPlugin

extends Object
implements SchedulerPlugin, JobListener

Logs a history of all job executions (and execution vetos) via the Jakarta Commons-Logging framework.

The logged message is customizable by setting one of the following message properties to a String that conforms to the syntax of `java.util.MessageFormat`.

JobToBeFiredMessage - available message data are:

Element | Data Type | Description
--- | --- | ---
0 | String | The Job's Name.
1 | String | The Job's Group.
2 | Date | The current time.
3 | String | The Trigger's name.
4 | String | The Triggers's group.
5 | Date | The scheduled fire time.
6 | Date | The next scheduled fire time.
7 | Integer | The re-fire count from the JobExecutionContext.

The default message text is "Job {1}.{0} fired (by trigger {4}.{3}) at: {2, date, HH:mm:ss MM/dd/yyyy}"

JobSuccessMessage - available message data are:

Element | Data Type | Description
--- | --- | ---
0 | String | The Job's Name.
1 | String | The Job's Group.
2 | Date | The current time.
3 | String | The Trigger's name.
4 | String | The Triggers's group.
5 | Date | The scheduled fire time.
6 | Date | The next scheduled fire time.
7 | Integer | The re-fire count from the JobExecutionContext.
8 | Object | The string value (toString() having been called) of the result (if any) that the Job set on the JobExecutionContext, with on it. "NULL" if no result was set.

The default message text is "Job {1}.{0} execution complete at {2, date, HH:mm:ss MM/dd/yyyy} and reports: {8}"

JobFailedMessage - available message data are:

Element | Data Type | Description
--- | --- | ---
0 | String | The Job's Name.
1 | String | The Job's Group.
2 | Date | The current time.
3 | String | The Trigger's name.
4 | String | The Triggers's group.
5 | Date | The scheduled fire time.
6 | Date | The next scheduled fire time.
7 | Integer | The re-fire count from the JobExecutionContext.
8 | String | The message from the thrown JobExecution Exception.

The default message text is "Job {1}.{0} execution failed at {2, date, HH:mm:ss MM/dd/yyyy} and reports: {8}"

JobWasVetoedMessage - available message data are:

Element | Data Type | Description
--- | --- | ---
0 | String | The Job's Name.
1 | String | The Job's Group.
2 | Date | The current time.
3 | String | The Trigger's name.
4 | String | The Triggers's group.
5 | Date | The scheduled fire time.
6 | Date | The next scheduled fire time.
7 | Integer | The re-fire count from the JobExecutionContext.

The default message text is "Job {1}.{0} was vetoed. It was to be fired (by trigger {4}.{3}) at: {2, date, HH:mm:ss MM/dd/yyyy}"

Author:
  James House

Constructor Summary
`LoggingJobHistoryPlugin()`

Method Summary
`String` | `getJobFailedMessage()` Get the message that is logged when a Job fails its execution.
`String` | `getJobSuccessMessage()` Get the message that is logged when a Job successfully completes its execution.
`String` | `getJobToBeFiredMessage()` Get the message that is logged when a Job is about to execute.
`String` | `getJobWasVetoedMessage()` Get the message that is logged when a Job execution is vetoed by a trigger listener.
`protected org.slf4j.Logger` | `getLog()`
`String` | `getName()` Get the name of the `JobListener`.
`void` | `initialize(String name, Scheduler scheduler)` Called during creation of the `Scheduler` in order to give the `SchedulerPlugin` a chance to initialize.
`void` | `jobExecutionVetoed(JobExecutionContext context)` Called by the ``Scheduler`` when a ``JobDetail`` was about to be executed (an associated ``Trigger`` has occurred), but a ``TriggerListener`` vetoed it's execution.
`void` | `jobToBeExecuted(JobExecutionContext context)` Called by the ``Scheduler`` when a ``JobDetail`` is about to be executed (an associated ``Trigger`` has occurred).
`void` | `jobWasExecuted(JobExecutionContext context, JobExecutionException jobException)` Called by the ``Scheduler`` after a ``JobDetail`` has been executed, and be for the associated `Trigger`'s `triggered(xx)` method has been called.
`void` | `setJobFailedMessage(String jobFailedMessage)` Set the message that is logged when a Job fails its execution.
`void` | `setJobSuccessMessage(String jobSuccessMessage)` Set the message that is logged when a Job successfully completes its execution.
`void` | `setJobToBeFiredMessage(String jobToBeFiredMessage)` Set the message that is logged when a Job is about to execute.
`void` | `setJobWasVetoedMessage(String jobWasVetoedMessage)` Set the message that is logged when a Job execution is vetoed by a trigger listener.
`void` | `shutdown()` Called in order to inform the `SchedulerPlugin` that it should free up all of it's resources because the scheduler is shutting down.
`void` | `start()` Called when the associated `Scheduler` is started, in order to let the plug-in know it can now make calls into the scheduler if it needs to.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LoggingJobHistoryPlugin

    public LoggingJobHistoryPlugin()

Method Detail

### getLog

    protected org.slf4j.Logger getLog()

### getJobSuccessMessage

    public String getJobSuccessMessage()

  Get the message that is logged when a Job successfully completes its execution.

### getJobFailedMessage

    public String getJobFailedMessage()

  Get the message that is logged when a Job fails its execution.

### getJobToBeFiredMessage

    public String getJobToBeFiredMessage()

  Get the message that is logged when a Job is about to execute.

### setJobSuccessMessage

    public void setJobSuccessMessage(String jobSuccessMessage)

  Set the message that is logged when a Job successfully completes its execution.

  Parameters:
    `jobSuccessMessage` - String in java.text.MessageFormat syntax.

### setJobFailedMessage

    public void setJobFailedMessage(String jobFailedMessage)

  Set the message that is logged when a Job fails its execution.

  Parameters:
    `jobFailedMessage` - String in java.text.MessageFormat syntax.

### setJobToBeFiredMessage

    public void setJobToBeFiredMessage(String jobToBeFiredMessage)

  Set the message that is logged when a Job is about to execute.

  Parameters:
    `jobToBeFiredMessage` - String in java.text.MessageFormat syntax.

### getJobWasVetoedMessage

    public String getJobWasVetoedMessage()

  Get the message that is logged when a Job execution is vetoed by a trigger listener.

### setJobWasVetoedMessage

    public void setJobWasVetoedMessage(String jobWasVetoedMessage)

  Set the message that is logged when a Job execution is vetoed by a trigger listener.

  Parameters:
    `jobWasVetoedMessage` - String in java.text.MessageFormat syntax.

### initialize

    public void initialize(String name,
                           Scheduler scheduler)
                    throws SchedulerException

  Called during creation of the `Scheduler` in order to give the `SchedulerPlugin` a chance to initialize.

  Specified by:
    `initialize` in interface `SchedulerPlugin`
  Parameters:
    `name` - The name by which the plugin is identified.
    `scheduler` - The scheduler to which the plugin is registered.
  Throws:
    `SchedulerConfigException` - if there is an error initializing.
    `SchedulerConfigException` - if there is an error initializing.
    `SchedulerException`

### start

    public void start()

  Description copied from interface: `SchedulerPlugin`

  Called when the associated `Scheduler` is started, in order to let the plug-in know it can now make calls into the scheduler if it needs to.

  Specified by:
    `start` in interface `SchedulerPlugin`

### shutdown

    public void shutdown()

  Called in order to inform the `SchedulerPlugin` that it should free up all of it's resources because the scheduler is shutting down.

  Specified by:
    `shutdown` in interface `SchedulerPlugin`

### getName

    public String getName()

  Description copied from interface: `JobListener`

  Get the name of the `JobListener`.

  Specified by:
    `getName` in interface `JobListener`

### jobToBeExecuted

    public void jobToBeExecuted(JobExecutionContext context)

  Description copied from interface: `JobListener`

  Called by the ``Scheduler`` when a ``JobDetail`` is about to be executed (an associated ``Trigger`` has occurred).

  This method will not be invoked if the execution of the Job was vetoed by a ``TriggerListener``.

  Specified by:
    `jobToBeExecuted` in interface `JobListener`
  See Also:
    `JobListener.jobToBeExecuted(JobExecutionContext)`

### jobWasExecuted

    public void jobWasExecuted(JobExecutionContext context,
                               JobExecutionException jobException)

  Description copied from interface: `JobListener`

  Called by the ``Scheduler`` after a ``JobDetail`` has been executed, and be for the associated `Trigger`'s `triggered(xx)` method has been called.

  Specified by:
    `jobWasExecuted` in interface `JobListener`
  See Also:
    `JobListener.jobWasExecuted(JobExecutionContext, JobExecutionException)`

### jobExecutionVetoed

    public void jobExecutionVetoed(JobExecutionContext context)

  Description copied from interface: `JobListener`

  Called by the ``Scheduler`` when a ``JobDetail`` was about to be executed (an associated ``Trigger`` has occurred), but a ``TriggerListener`` vetoed it's execution.

  Specified by:
    `jobExecutionVetoed` in interface `JobListener`
  See Also:
    `JobListener.jobExecutionVetoed(org.quartz.JobExecutionContext)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001-2012, Terracotta, Inc.