[Dancer-users] Allow alternate path in Dancer::Logger::File?

Mike Schroeder mike at donor.com
Thu Oct 28 17:45:08 CEST 2010


Thanks Flavio - good rewrite.

Regarding the symlinks, the issue is that we are deploying Dancer on our
grid, so we try to minimize the amount of customization required to add a
node to a cluster.  Much easier to update one shared config file than to
have each node need to add a symlink on bootup.

Since Dancer is so flexible to allow us to easily override the Logger, and
since it sounds like we are an edge case, you can forget about my idea to
add this to the core.

Thanks for listening.

Mike.


On Thu, Oct 28, 2010 at 3:42 AM, Flavio Poletti <polettix at gmail.com> wrote:

> As a quick workaround, if your read-only filesystem (and your OS too!)
> supports linking you could make 'logs' point to the directory you really
> want to use for logs. 99% of chances that you had a good reason not to do
> that, but sometimes it's difficult to see the wood if one is concentrating
> on the trees.
>
> Personally, I would rewrite your sub as follows:
>
> sub logdir {
>     my $altpath = setting('log_path');
>     return $altpath if $altpath;
>
>     my $appdir = setting('appdir');
>     my $logroot = $appdir || File::Spec->tmpdir();
>     return path($logroot, 'logs');
> }
>
> I see no reason to possibly create a temporary directory if you don't
> really need to.
>
> Cheers,
>
>    Flavio.
>
>
>
> On Wed, Oct 27, 2010 at 8:11 PM, Mike Schroeder <mike at donor.com> wrote:
>
>> Currently the logdir() method in Dancer::Logger::File looks like:
>>
>> sub logdir {
>>     my $appdir = setting('appdir');
>>     my $logroot = $appdir || File::Spec->tmpdir();
>>     return path($logroot, 'logs');
>> }
>>
>>
>> However, our production environments all mount off read-only filesystems, so having logging dependant on appdir won't work. I can write a new logger module that does something like:
>>
>>
>> sub logdir {
>>     my $appdir = setting('appdir');
>>     my $altpath = setting('log_path');
>>     my $logroot = $appdir || File::Spec->tmpdir();
>>     return ( $altpath ? $altpath : path($logroot, 'logs') );
>> }
>>
>>
>> Is that something that is worth going into the core?  I'm fine either way,
>> but I thought this might be useful to others in the future.
>>
>> Thanks.
>>
>> Mike.
>>
>>
>>
>> _______________________________________________
>> Dancer-users mailing list
>> Dancer-users at perldancer.org
>> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20101028/3aa2940c/attachment.htm>


More information about the Dancer-users mailing list