# Is this common

**URL:** <https://www.ruby-forum.com/t/is-this-common/113408>\
**Category:** Rails\
**Created:** [August 30, 2007, 8:50pm UTC](https://www.ruby-forum.com/t/is-this-common/113408 "2007-08-30T20:50:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bloc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@bloc](https://www.ruby-forum.com/u/bloc)\
**Post date:** [August 30, 2007, 8:50pm UTC](https://www.ruby-forum.com/t/is-this-common/113408/1 "2007-08-30T20:50:17Z")

</div>

Hi,  
I have a webapp built using ruby on rails. The login page takes the  
username and password.  
When I run the application and check the development.log file I see the  
passwords in that file in text format of users loggin in.  
Is this common? I’m the administrator so only I have access to those  
files, but still is there a way for me to tell rails not to spit out all  
those lines in the log files.

Thanks,  
Dev

---

<div class="post-metadata">

**Author:** ![bloc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@bloc](https://www.ruby-forum.com/u/bloc)\
**Post date:** [August 30, 2007, 9:01pm UTC](https://www.ruby-forum.com/t/is-this-common/113408/2 "2007-08-30T21:01:43Z")

</div>

Jay D. wrote:

> Dev

Add this to your application.rb…

filter\_parameter\_logging “password”

–  
[http://www.5valleys.com/](http://www.5valleys.com/)

---

<div class="post-metadata">

**Author:** ![bloc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@bloc](https://www.ruby-forum.com/u/bloc)\
**Post date:** [August 30, 2007, 9:26pm UTC](https://www.ruby-forum.com/t/is-this-common/113408/3 "2007-08-30T21:26:52Z")

</div>

Jon G. wrote:

> Jay D. wrote:
> 
> > Dev
> 
> Add this to your application.rb…
> 
> filter\_parameter\_logging “password”
> 
> –  
> [http://www.5valleys.com/](http://www.5valleys.com/)

Jon,  
Thank you, that worked. BTW, how often do you delete log files and is  
there a command you use to delete the file or clear the file.

Thanks.

---

<div class="post-metadata">

**Author:** ![bloc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@bloc](https://www.ruby-forum.com/u/bloc)\
**Post date:** [August 30, 2007, 11:07pm UTC](https://www.ruby-forum.com/t/is-this-common/113408/4 "2007-08-30T23:07:54Z")

</div>

You should consider analyze your log files and then truncate it with:

rake log:clear # Truncates all \*.log files in log/ to  
zero bytes

---

<div class="post-metadata">

**Author:** ![bloc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@bloc](https://www.ruby-forum.com/u/bloc)\
**Post date:** [August 31, 2007, 1:42am UTC](https://www.ruby-forum.com/t/is-this-common/113408/5 "2007-08-31T01:42:09Z")

</div>

Jay D. wrote:

> Jon,  
> Thank you, that worked. BTW, how often do you delete log files and is  
> there a command you use to delete the file or clear the file.
> 
> Thanks.

You can add something like this to your environment.rb…

#Rotate logs on server restart  
config.logger = Logger.new(“#{RAILS\_ROOT}/log/#{ENV[‘RAILS\_ENV’]}.log”,  
5, 1048576)

I believe the above settings are keep the last 5 log files, and limit  
their size to 1048576 bytes. (Don’t ask me why we have that particular  
file size in our config. I must have been in a strange mood that day.)

–  
[http://www.5valleys.com/](http://www.5valleys.com/)

---

<div class="post-metadata">

**Author:** ![bloc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@bloc](https://www.ruby-forum.com/u/bloc)\
**Post date:** [August 31, 2007, 8:21am UTC](https://www.ruby-forum.com/t/is-this-common/113408/6 "2007-08-31T08:21:35Z")

</div>

Jon G. wrote:

> #Rotate logs on server restart  
> config.logger = Logger.new("#{RAILS\_ROOT}/log/#{ENV[‘RAILS\_ENV’]}.log",  
> 5, 1048576)
> 
> I believe the above settings are keep the last 5 log files, and limit  
> their size to 1048576 bytes. (Don’t ask me why we have that particular  
> file size in our config. I must have been in a strange mood that day.)

1048576 is exactly 1MByte (1024 x 1024)… Is that why?

Cheers,  
Mohit.  
8/31/2007 | 2:20 PM.
