You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Anand Prahlad <an...@onsiterx.com> on 2001/01/16 16:07:15 UTC

Logging to a database...

Hi all,

I have been playing with Log4J for a while and I should record my
appreciation here for its development, maintenance and extension.

I have a requirement on my current project to log to a database. First
question is: Is it a good design idea to log debug and/or error information
to a database (assumption: it's a relational database) ?

Does anyone have any experience/thoughts about this? I can certainly buy the
argument that it might be easier to generate reports and such using standard
SQL tools (example: How many errors this month for a category named
HARDWARE? etc..)

Second question is: Has anyone extended Log4J to do this or thought about
how it could be done? If so, I'd appreciate some pointers on how to go about
doing precisely that.

Thanks and best regards to all,
Anand


RE: Logging to a database...

Posted by Mike Cannon-Brookes <mc...@internet.com>.
The other alternative here Ernst (g'day mate! ;)) is to use the JMSAppender,
with a MessageBean (EJB2) and an Entity bean. Surely using a hammer to crack
a walnut, but it would be a fun project - and would get your log messages
into the DB.

-mike

> -----Original Message-----
> From: Ernst de Haan [mailto:ernst@jollem.com]
> Sent: Wednesday, January 17, 2001 6:18 AM
> To: LOG4J Users Mailing List
> Cc: Anand Prahlad
> Subject: Re: Logging to a database...
>
>
> Heya guys,
>
> > >I have a requirement on my current project to log to a database. First
> > >question is: Is it a good design idea to log debug and/or
> error information
> > >to a database (assumption: it's a relational database) ?
> >
> > Every now and then there is a request for a JDBCAppender that
> would log to
> > a database. This hasn't been done for a number of reasons:
>
> If you want to have your log statements fed into a database, I suggest you
> write them to a plain text file first, and then import them using
> a database
> import utility. This should be pretty easy, as Log4J allows you
> to specify the
> format for the log messages.
>
> This avoids the overhead of a relational database (these boys are
> usually very
> demanding).
>
> You can automate both the import of the data into the database and the
> analysis of the log messages (using a few SELECT statements).
>
>
> --
> Ernst
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
>


Re: Logging to a database...

Posted by Ernst de Haan <er...@jollem.com>.
Heya guys,

> >I have a requirement on my current project to log to a database. First
> >question is: Is it a good design idea to log debug and/or error information
> >to a database (assumption: it's a relational database) ?
> 
> Every now and then there is a request for a JDBCAppender that would log to 
> a database. This hasn't been done for a number of reasons:

If you want to have your log statements fed into a database, I suggest you
write them to a plain text file first, and then import them using a database
import utility. This should be pretty easy, as Log4J allows you to specify the
format for the log messages.

This avoids the overhead of a relational database (these boys are usually very
demanding).

You can automate both the import of the data into the database and the
analysis of the log messages (using a few SELECT statements).


--
Ernst

Re: Logging to a database...

Posted by Ceki Gulcu <cg...@urbanet.ch>.
Hello Anand,


At 10:07 16.01.2001 -0500, you wrote:
>Hi all,
>
>I have been playing with Log4J for a while and I should record my
>appreciation here for its development, maintenance and extension.
>
>I have a requirement on my current project to log to a database. First
>question is: Is it a good design idea to log debug and/or error information
>to a database (assumption: it's a relational database) ?

Every now and then there is a request for a JDBCAppender that would log to 
a database. This hasn't been done for a number of reasons:

1) Logging to a database would be slow, probably very slow.

2) It would be trivial for someone familiar with JDBC to write an 
appender  that would log to an existing database. It would be harder to 
write a generic JDBCAppender that could log to *any* relational database 
regardless of table structure, etc...

3) What would be the benefit of logging to a database? IMHO, asking how 
many errors this month to HARDWARE category is a bit contrived but that's 
just my uneducated opinion. Ceki




>Does anyone have any experience/thoughts about this? I can certainly buy the
>argument that it might be easier to generate reports and such using standard
>SQL tools (example: How many errors this month for a category named
>HARDWARE? etc..)
>
>Second question is: Has anyone extended Log4J to do this or thought about
>how it could be done? If so, I'd appreciate some pointers on how to go about
>doing precisely that.
>
>Thanks and best regards to all,
>Anand
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org

---
Freedom as in the capacity to exercise choice.