public function cleanLog()
    {
        $em = $this->getEm();
        $lifetime = array(
            Mapper\Cronjob::STATUS_SUCCESS  =>
                $this->getSuccessLogLifetime() * 60,
            Mapper\Cronjob::STATUS_MISSED   =>
                $this->getFailureLogLifetime() * 60,
            Mapper\Cronjob::STATUS_ERROR    =>
                $this->getFailureLogLifetime() * 60,
        );

        $history = $em->getRepository('AdfabCore\Entity\Cronjob')
            ->getHistory();

        $now = time();
        foreach ($history as $job) {
            if ($job->getExecuteTime()
                && $job->getExecuteTime()->getTimestamp()
                    < $now - $lifetime[$job->getStatus()]) {
                $em->remove($job);
            }
        }

        $em->flush();

        return $this;
    }