logging-log4php-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Hammers ...@lathspell.de>
Subject LOG4PHP-47: AppenderPDO with quotes
Date Wed, 16 Sep 2009 00:38:41 GMT

I've started to write a fix for this bug. It already works for the below
properties file but is not yet fully tested. So I thought that I ask
for comments before I finish it tomorrow :)

The premises were:
- log4j/log4cxx suffers from quotation problems as well so no cut&paste from there
- log4perl uses .sql and .param.1 until .param.3 which our option parser
  does not support. It stops after .param and apparently has no way to build
  an array from forther params. Too bad, no compatibility possible.
- log4net replaces the format strings in the given sql statement. I don't like
  that, what if the user says: VALUES (%p, %c, replace('_', '-', %m)). The syntax
  for database logging is quite different anyway so not so important to 
  stay compatible.
- Old code which specified .sql should continue to work although the variables
  will be marked @deprecated. Btw, is there some kind of significant user base 
  at all?
- The actual pattern replacement still has to be made by LayoutPattern but I
  will give it a $this->layout->formatToArray($event); method that returns an
  array that will be passed to the $this->$preparedInsert->execute()

log4php.rootLogger = DEBUG, a1, a2
log4php.appender.a1 = LoggerAppenderPDO
log4php.appender.a1.user = root
log4php.appender.a1.password = secret
log4php.appender.a1.dsn = "mysql:host=localhost;dbname=test"
log4php.appender.a1.createTable = true
log4php.appender.a1.table = log1
; the following shows an appender with customized INSERT statment
log4php.appender.a2 = LoggerAppenderPDO
log4php.appender.a2.dsn = "sqlite:target/appender_pdo.sqlite"
log4php.appender.a2.createTable = false
log4php.appender.a2.insertSql = "INSERT INTO log2 (timestamp, logger, level, message, thread,
file, line) VALUES (?,?,?,?,?,?,?)"
; only format strings and "," without spaces or other stuff
log4php.appender.a2.insertPattern = "%d,%c,%p,%m,%t,%F,%L"



View raw message