# Log4r database outputter

**URL:** <https://www.ruby-forum.com/t/log4r-database-outputter/93530>\
**Category:** Rails\
**Created:** [April 4, 2006, 1:57pm UTC](https://www.ruby-forum.com/t/log4r-database-outputter/93530 "2006-04-04T13:57:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ed\_Syrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a587f6/32.png) [@Ed\_Syrett](https://www.ruby-forum.com/u/Ed_Syrett)\
**Post date:** [April 4, 2006, 1:57pm UTC](https://www.ruby-forum.com/t/log4r-database-outputter/93530/1 "2006-04-04T13:57:04Z")

</div>

I recently had a look at Log4Net before we decided to go with Ruby On  
Rails. As  
part of evaluating Ruby and Rails, I had a look at Log4r as well.

We want to use Log4r, and we would have a logger that output all levels  
to  
console and stdout, and everything above Warn to a database table. But  
the  
deployment of log4r doesn’t come with a database outputter. Is there  
any  
reason for this?

Anyway, I’ve written an outputter for log4r that uses Ruby DBI and the  
ODBC  
driver for MySQL. I’ve also enhanced the basic formatter and logevent  
to accept  
an optional extra field after the message. This eventually gets written  
to the  
userid column in the database so that we can find out who’s been  
wrecking our  
system :-D. Because the field is optional, Rails is happy to use log4r  
to  
output its own messages.

I tried contacting the author of Log4r, but got no response. Does  
anyone want  
these enhancements? Should I upload the changes somewhere? In any case  
I’d  
like somebody to peer review the enhancements in case there are  
scalability  
issues etc.

Cheers,

Ed.
