The sfTaskLoggerPlugin allow you to run tasks and store the results. Results
are stored in the database in a specific table and also in a log file. Each task
has its own log file, witch is stored in a specific directory depending on its
namespace and name. (/log/tasks/:TASK_NAMESPACE/:TASK_NAME).

The sfTaskLoggerPlugin allows you to run custom tasks and store the results. Results are stored in the database in a specific table and/or in a log file. Each task
has its own log file, which is stored in a specific directory depending on its namespace and name. (/log/task/:TASK_NAMESPACE/:TASK_NAME). It allows you to have a clean log history of all the CRON executed by your symfony project.

Developers

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release 1.0.1 - 08/09/2009

Release 1.0.0 - 08/09/2009

sfTaskLoggerPlugin

The sfTaskLoggerPlugin allow you to run tasks and store the results. Results
are stored in the database in a specific table and also in a log file. Each task
has its own log file, witch is stored in a specific directory depending on its
namespace and name. (/log/tasks/:TASK_NAMESPACE/:TASK_NAME).

The database record stores the following informations:

An error code

Start and end time

A success flag

The log file path

Extra comments (for admin)

The plugin is Doctrine and
Propel friendly, it you are using Doctrine, the
/lib/config/doctrine/schema.yml will be used whereas using Propel
the /lib/config/schema.yml will be used.

Installation

Install the plugin

$ symfony plugin:install sfTaskLoggerPlugin

(or download it and unzip in your /plugins directory)

Clear you cache

$ symfony cc

Configuration

The plugin comes with a base task class witch is named sfBaseTaskLoggerTask
Therefore your tasks must extend this one. Because there is no autoloading at
the task level. Therefore, one must include the base class manually:

require_once(dirname(__FILE__). '/sfBaseTaskLoggerTask.class.php');

Of course you will have to change this path depending on where is located your
task. For example if it is located in the /lib/task folder of your project,
the include directive should look like this:

This is the main method of your task process. $this->task is the database
object that will be saved. As you can see the setOk() and setNOk methods
allow to set the flag of the record automatically depending on the success or
failure of the task.

If you want more control on the task process you can also re-implement the execute()
method of the base class witch is responsible for calling all others sub functions: