Log4php
  1. Log4php
  2. LOG4PHP-79

AppenderPDO: Some database fields seem a bit too short

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0
    • Component/s: Code
    • Labels:
      None

      Description

      The default CREATAE TABLE statement in LoggerAppenderPDO is:

      $query = "CREATE TABLE {$this->table} ( timestamp varchar(32)," .
      "logger varchar(32)," .
      "level varchar(32)," .
      "message varchar(64)," .
      "thread varchar(32)," .
      "file varchar(64)," .
      "line varchar(4) );";

      It seems to me that 64 chars for the filename and message are a bit short.
      Even our examples are so deeply nested that the .php from the file name got cut off.
      I won't even think of a typical log message.

      I would propose to go for varchar(255) or even text ("clob") for message, varchar(255) for file and "int unsigned" for line (currently it looks like "9999 lines show be enough for everyone!"

        Activity

        Hide
        Christian Grobmeier added a comment -

        I totally agree.

        We just need to make sure to have some kind of standard sql which is beeing understood at least for the most databases. Maybe we need to write some more code for independency.

        Show
        Christian Grobmeier added a comment - I totally agree. We just need to make sure to have some kind of standard sql which is beeing understood at least for the most databases. Maybe we need to write some more code for independency.
        Hide
        Christian Hammers added a comment -

        For example log4j does not have a CREATE statement at all and expects the use to create the table.
        Therefore I would suggest to simply raise the varchar length to say 2000, which I confirmed to work at least on sqlite, MySQL 5.1 MyISAM and InnoDB as well as PostgreSQL 8.4 and which is supposed to work on Oracle, too.
        Additionally the documentation could suggest to create the table oneself or at least tune it because we don't add indices anyway.

        Show
        Christian Hammers added a comment - For example log4j does not have a CREATE statement at all and expects the use to create the table. Therefore I would suggest to simply raise the varchar length to say 2000, which I confirmed to work at least on sqlite, MySQL 5.1 MyISAM and InnoDB as well as PostgreSQL 8.4 and which is supposed to work on Oracle, too. Additionally the documentation could suggest to create the table oneself or at least tune it because we don't add indices anyway.
        Hide
        Christian Hammers added a comment -

        fixed in svn

        Show
        Christian Hammers added a comment - fixed in svn
        Hide
        Christian Hammers added a comment -

        fixed in svn

        Show
        Christian Hammers added a comment - fixed in svn

          People

          • Assignee:
            Christian Hammers
            Reporter:
            Christian Hammers
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development