PHPackages                             thunderwolf/sf-task-logger-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. thunderwolf/sf-task-logger-plugin

AbandonedSymfony1-plugin[Logging &amp; Monitoring](/categories/logging)

thunderwolf/sf-task-logger-plugin
=================================

symfony 1.x Task Logger plugin - Allow you to run tasks and store the results in both database and/or a log file.

1.0.5(12y ago)11451MITPHP

Since Jun 8Pushed 12y ago2 watchersCompare

[ Source](https://github.com/thunderwolf/sf-task-logger-plugin)[ Packagist](https://packagist.org/packages/thunderwolf/sf-task-logger-plugin)[ Docs](http://www.symfony-project.org/)[ RSS](/packages/thunderwolf-sf-task-logger-plugin/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (4)Used By (1)

sfTaskLoggerPlugin
------------------

[](#sftaskloggerplugin)

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/tasks/:TASK_NAMESPACE/:TASK_NAME`). It allows you to have a clean log history of all the CRON executed by your symfony project.

The database record stores the following informations:

- Name of the task
- List of arguments of the task
- List of options of the task
- Count of processed records
- Count of NOT processed records
- Flag that tells if task is actually running
- Last record Id fully processed without error
- Process start time
- Process end time
- Flag that tells if task finished without error
- An error code for success or failure of the task
- The full console output of the task (optional)
- The log file path associated to the task
- Additional admin comments about the task and its results (can be modified with the admin generator module)

The plugin base task has several useful options:

- `config`: The YAML config used by the plugin (explained in the next section)
- `check-running`: Check that the task is not currently running
- `only-processed`: Record into log or database only if there were things processed by the task
- `once-by-day`: Check that the task was not already executed once today

> **Note**The plugin is both [Doctrine](http://www.doctrine-project.org) and [Propel](http://propel.phpdb.org) 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. (I am sorry but I didn't test the Propel version with the last 1.4 package, so feel free to report me issues if you use it with Propel. Neither the admin generator module is available.)

Installation
============

[](#installation)

- Install the plugin:

    ```
     $ symfony plugin:install sfTaskLoggerPlugin

    ```

    (download it and unzip in your `/plugins` directory or use svn `http://svn.symfony-project.com/plugins/sfTaskLoggerPlugin/tags/sfTaskLoggerPlugin_1_0_4/`)
- Build the new plugin table and associated models:

    ```
     $ ./symfony doctrine:build --all-classes --db --and-load --env=dev

    ```

(or launch each "build" task individually)

Or for Propel:

```
    $ symfony propel:build-all-load

```

> **Note**At this point you should have
>
> - A new table called `tl_tasks` in your database
> - A new set of model classes in `lib/model/sfTaskLoggerPlugin` or `lib/model/doctrine/sfTaskLoggerPlugin`

- Clear you cache

    ```
     $ symfony cc

    ```

Configuration
=============

[](#configuration)

The plugin comes with a *base* task class which is named `sfBaseTaskLoggerTask`Therefore your tasks must extend this one. Because there is no auto-loading at the task level, one must include it manually:

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

```

> **Note**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, use the following code.
>
> Generally you will want to extend all your tasks with a custom project task so all of them will benefit from its generic methods, arguments or options (thus, it must stay abstract). It would looks like this:

```
[php]
/**
 * This the base task for all tasks of myProject.
 *
 * @author COil
 * @since  01/09/2010
 */

require_once(dirname(__FILE__). '/../../plugins/sfTaskLoggerPlugin/lib/task/sfBaseTaskLoggerTask.class.php');

abstract class mySuperBaseTask extends sfBaseTaskLoggerTask
{
  /**
   * This function is callable by all the project tasks.
   */
  public function superFunction()
  {
  }
}

```

Your final task should extends this custom task and look like this:

```
[php]
/**
 * This a custom task
 *
 * @author Vernet Loïc aka COil
 * @since  1.0.0 - 7 aug 2009
 */
class sfMyTask extends mySuperBaseTask
{
  // check the following section for functions to implement
}

```

---

Moreover the plugin comes with a *default* YAML configuration file, this file allows you to tell if you want to log into the database, a file or both:

- Copy the `/plugins/sfTaskLoggerPlugin/config/plugin_sftl.yml` into the `config` folder of your application. Then this file will be used.
- Now, you can add your own configurations. (copy paste the default one and rename the key of the configuration) You should keep the `default` one which is the basic configuration provided by the plugin.
- To use a specific config for a task, pass a `config` option to the task. (--config=myConfig) where `myConfig` is the key of your configuration. If the config is invalid an alert will be raised.

Usage
=====

[](#usage)

In your task (like `sfMyTask` above):

- 1 - Implement the `configure()` method as you would do with a standard task: (don't forget to call the parent method to include generic parameters and options)

    ```
    [php]
      /**
       * Main task configuration.
       */
      protected function configure()
      {
        parent::configure();

        $this->addArguments(array(
          new sfCommandArgument('arg_1', sfCommandArgument::OPTIONAL, 'Test argument 1', 'arg_1_value'),
          new sfCommandArgument('arg_2', sfCommandArgument::OPTIONAL, 'Test argument 2', 'arg_2_value'),
        ));

        $this->namespace = 'sf_task_logger';
        $this->name      = 'sample';

        $this->briefDescription = 'This is a sample task !';

        $this->detailedDescription =  **Note**The plugin comes with a route `tl_task` for this admin generator module.

Notes
=====

[](#notes)

> **Note**The plugin is bundled with a sample task: `/lib/task/sfTaskLoggerSampleTask.class.php`which can be run with the following command (replace "frontend" with a valid application name of your project and "dev" with a valid environment):
>
> ```
> > ./symfony task-logger:sample --application="frontend" --env="dev"
>
> ```
>
>
>
> And also with a task: `/lib/task/sfTaskLoggerPurgeRunningTask.class.php`to purge tasks who ended with a fatal error and which stayed with the running flag to "ON":
>
> ```
> > ./symfony task-logger:purge --task="myProject:myTask" --application=backend --env="dev"
>
> ```

Console output
==============

[](#console-output)

You may want to have your console output disabled when running cron tasks, for example because of some server related configuration - in this case, add the **--quiet** option to your cli command line:

```
 ./symfony task-logger:sample --application=frontend --env="prod" --quiet

```

TODO
====

[](#todo)

- V1.1.0: Advanced features to keep a state of "processed objects"
- V1.0.5: Test the Propel version

Support
=======

[](#support)

Send me an email or report bugs on the symfony TRAC, I could also answer if you ask on the symfony mailing list.

Changelog
=========

[](#changelog)

(check the changelog tab)

---

See you. [COil](http://www.strangebuzz.com) :)

---

This plugin is sponsored by [SQL Technologies](http://www.sqltechnologies.com)

[![SQL Technologies](https://camo.githubusercontent.com/635d8f83a3a8223406bd53684a6c3eec1db13f4da9f090624d4fe591fd1c615b/687474703a2f2f7777772e7068702d64656275672e636f6d2f696d616765732f73716c2e676966)](https://camo.githubusercontent.com/635d8f83a3a8223406bd53684a6c3eec1db13f4da9f090624d4fe591fd1c615b/687474703a2f2f7777772e7068702d64656275672e636f6d2f696d616765732f73716c2e676966)

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~88 days

Total

3

Last Release

4542d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/05eb48f56bd630f26cd358aaf476c92d809992b340036035a400b4d585b3fb72?d=identicon)[thunderwolf](/maintainers/thunderwolf)

---

Top Contributors

[![ldath](https://avatars.githubusercontent.com/u/64095?v=4)](https://github.com/ldath "ldath (4 commits)")

---

Tags

symfonytask

### Embed Badge

![Health badge](/badges/thunderwolf-sf-task-logger-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/thunderwolf-sf-task-logger-plugin/health.svg)](https://phpackages.com/packages/thunderwolf-sf-task-logger-plugin)
```

###  Alternatives

[bugsnag/bugsnag-symfony

Official BugSnag notifier for Symfony applications.

453.0M3](/packages/bugsnag-bugsnag-symfony)[inspector-apm/inspector-symfony

Code Execution Monitoring for Symfony applications.

2830.1k2](/packages/inspector-apm-inspector-symfony)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
