On Sat, 24 Sep 2005, Joe Van Dyk wrote:

> On 9/23/05, Ara.T.Howard <Ara.T.Howard / noaa.gov> wrote:
>> On Sat, 24 Sep 2005, Joe Van Dyk wrote:
>>
>>> There seem to have been a bunch of filesystem-related releases
>>> recently.  So I'm not sure if one of them would address my problem
>>> better than something that's in the standard library.
>>>
>>> I'm starting a bunch of applications and need to write their stdout
>>> and stderr to logs.  Log files are stored at /<some_base_path>/<user
>>> name>/<application name>.log.
>>>
>>> What's the simplest way of creating all those directories (assuming
>>> that none of them exist)?
>>
>> require 'fileutils'
>> FileUtils::mkdir_p 'dir'
>>
>> you don't need to care if it exsts and all subdirs are created on the fly.
>
>
> Thanks!
>
> And a related question:  Every time I start an application, I want to write
> to a new log file.  But I want to keep the old log files around (i.e. rotate
> them).  Can I do that with Logger?  I see options for rotating when a log
> file gets to a certain size or on a daily, weekly, monthly basis, but not
> when I'm creating a new one.

   require 'logger'

   logger = Logger:new 'log', log_age

   # or

   logger = Logger:new 'log', log_age, log_size


   # log_age can be daily|weekly|monthly|number_of_days

whammo.  log rolling.

-a
-- 
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| Your life dwells amoung the causes of death
| Like a lamp standing in a strong breeze.  --Nagarjuna
===============================================================================