It seems by calling rotate with $override set to true you are
neglecting any --period=x setting.  Ok i guess this can make sense to
some people.  So now you use your crontab to define your "period":
0 0 * * 7 symfony log:rotate frontend prod --period=14 --history=10 > /
dev/null

WIth that cron entry you would have your logs rotate on every sunday
at midnight, regardless of the period being set to 14 days.  Correct?

It almost seems that this task's configuration is too vague.  To fix
this I suggest removing override from the


          protected function execute($arguments = array(), $options = array
())
          {
            $app = $arguments['application'];
            $env = $arguments['env'];
            $override = ($options['override'] == true) ? true : false;
            $this->rotate($app, $env, $options['period'], $options
['history'], $override);
          }

That way you can still override and force a rotate from the cmd line
if you want. And without overriding the rotate sf task still obeys the
period you provide.

This would probably also require:
            if (!$rotateOn || ($rotateOn == $today) || $override)
            {
to be:
            if (!$rotateOn || ($rotateOn <= $today) || $override)
            {
incase your cron period and your rotate period are not in sync.

I guess ideally the documentation for this feature would be better
explained or even just have a best practices laid out, for example:

Run your log-rotate task daily and set your period in the command
options. (if we turn off override by default)

or

Run your log-rotate task at the interval you want your logs to be
rotated at and just require the history option.  Because when that
override is set to true we the task doesn't care what period is. (if
we leave override on by default)

I wonder if I'm the only one that's looked into this or if anyone has
an opinion?

Thanks guys,
Jason

On Aug 11, 3:15 pm, jason <jpb0...@gmail.com> wrote:
> I found this 
> interesting:http://trac.symfony-project.org/browser/branches/1.2/lib/task/log/sfL...
>
> It seems when this task is calling rotate it is overriding the time
> checks by setting $override to true.
>
> Correct me if I'm wrong but doesn't it seem like that would break the
> date logic in place and forces a log rotation no matter what the date
> is?
>
> Thanks,
> Jason
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to