You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by Ivan Habunek <iv...@gmail.com> on 2012/02/24 10:29:40 UTC
Proposal: database appender should not create tables
Hi all,
The current database appender has an option of creating a table if
none exists. I would prefer that it doesn't. There are two main
reasons:
1. You cannot be sure that the CREATE TABLE statement will work on
every database.
2. Since we don't know to which database we're connecting, it is
impossible to deduct which error the database reported (was it "table
not found" or "invalid password"). See current code, it's not nice.
Instead, I would create a folder where CREATE TABLE statements will be
located for different databases. Similar to the way done on logback:
https://github.com/ceki/logback/tree/master/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect
Also in the works:
- retry on failed log (to solve LOG4PHP-134)
- adaptations for the new pattern layout which pdo appender uses
Regards,
Ivan
Re: Proposal: database appender should not create tables
Posted by Florian Semm <Fl...@gmx.de>.
-------- Original-Nachricht --------
> Datum: Fri, 24 Feb 2012 10:29:40 +0100
> Von: Ivan Habunek <iv...@gmail.com>
> An: Log4php Dev <lo...@logging.apache.org>
> Betreff: Proposal: database appender should not create tables
> Hi all,
>
> The current database appender has an option of creating a table if
> none exists. I would prefer that it doesn't. There are two main
> reasons:
> 1. You cannot be sure that the CREATE TABLE statement will work on
> every database.
> 2. Since we don't know to which database we're connecting, it is
> impossible to deduct which error the database reported (was it "table
> not found" or "invalid password"). See current code, it's not nice.
>
> Instead, I would create a folder where CREATE TABLE statements will be
> located for different databases. Similar to the way done on logback:
> https://github.com/ceki/logback/tree/master/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect
>
to store the command in a sql-file looks a bit disgusting.
I think the user should do the creation himself. a special-part in the documention should be enough.
> Also in the works:
> - retry on failed log (to solve LOG4PHP-134)
> - adaptations for the new pattern layout which pdo appender uses
>
> Regards,
> Ivan
regards florian
Re: Proposal: database appender should not create tables
Posted by Christian Grobmeier <gr...@gmail.com>.
On Fri, Feb 24, 2012 at 10:52 AM, Ivan Habunek <iv...@gmail.com> wrote:
> On 24 February 2012 10:43, Christian Grobmeier <gr...@gmail.com> wrote:
>> I am not sure about the "create table" statments. Do you mean they
>> need to be executed by hand? Or is this some kind of automatic
>> process?
>
> They are for people who are not sure how to create an appropriate
> table and will have to be executed by hand.
ok +1 on that.
> Regards,
> Ivan
--
http://www.grobmeier.de
https://www.timeandbill.de
Re: Proposal: database appender should not create tables
Posted by Ivan Habunek <iv...@gmail.com>.
On 24 February 2012 10:43, Christian Grobmeier <gr...@gmail.com> wrote:
> I am not sure about the "create table" statments. Do you mean they
> need to be executed by hand? Or is this some kind of automatic
> process?
They are for people who are not sure how to create an appropriate
table and will have to be executed by hand.
Regards,
Ivan
Re: Proposal: database appender should not create tables
Posted by Christian Grobmeier <gr...@gmail.com>.
On Fri, Feb 24, 2012 at 10:29 AM, Ivan Habunek <iv...@gmail.com> wrote:
> Hi all,
>
> The current database appender has an option of creating a table if
> none exists. I would prefer that it doesn't. There are two main
> reasons:
> 1. You cannot be sure that the CREATE TABLE statement will work on
> every database.
> 2. Since we don't know to which database we're connecting, it is
> impossible to deduct which error the database reported (was it "table
> not found" or "invalid password"). See current code, it's not nice.
>
> Instead, I would create a folder where CREATE TABLE statements will be
> located for different databases. Similar to the way done on logback:
> https://github.com/ceki/logback/tree/master/logback-classic/src/main/java/ch/qos/logback/classic/db/dialect
I am +1 on removing the sql from the appender.
I am not sure about the "create table" statments. Do you mean they
need to be executed by hand? Or is this some kind of automatic
process?
> Also in the works:
> - retry on failed log (to solve LOG4PHP-134)
aaaaah great!
> - adaptations for the new pattern layout which pdo appender uses
Also cool!
Cheers
>
> Regards,
> Ivan
--
http://www.grobmeier.de
https://www.timeandbill.de