# Logger in ruby

**URL:** <https://www.ruby-forum.com/t/logger-in-ruby/161197>\
**Category:** Ruby\
**Created:** [February 24, 2009, 9:03am UTC](https://www.ruby-forum.com/t/logger-in-ruby/161197 "2009-02-24T09:03:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vetrivel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/dc4da7/32.png) [@vetrivel](https://www.ruby-forum.com/u/vetrivel)\
**Post date:** [February 24, 2009, 9:03am UTC](https://www.ruby-forum.com/t/logger-in-ruby/161197/1 "2009-02-24T09:03:19Z")

</div>

Logger class in ruby.

Syntax of creating logger  
Logger.new(logdev, shift\_age = 0, shift\_size = 1048576)

Description  
logdev: The log device. This is a filename (String) or IO object  
(typically STDOUT, STDERR, or an open file).

shift\_age: Number of old log files to keep, or frequency of rotation  
(daily, weekly or monthly).

shift\_size: Maximum logfile size (only applies when shift\_age is a  
number

My question  
In shift\_age field we can specify the number of old log files  
to keep, but i have to keep all the files.Is it possible in Logger? How?

---

<div class="post-metadata">

**Author:** ![vetrivel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/dc4da7/32.png) [@vetrivel](https://www.ruby-forum.com/u/vetrivel)\
**Post date:** [February 24, 2009, 10:28am UTC](https://www.ruby-forum.com/t/logger-in-ruby/161197/2 "2009-02-24T10:28:13Z")

</div>

Vetrivel V. wrote:

> My question  
> In shift\_age field we can specify the number of old log files  
> to keep, but i have to keep all the files.Is it possible in Logger? How?

I suggest you look at the source code. It’s probably installed in  
/usr/lib/ruby/1.8/logger.rb or somewhere similar on your system.
