I'm using Log::Log4perl::Appender::DBI and I have a few end-user 
suggestions to make.

I have a significant slab of existing Log::Log4perl code which uses 
variable number of arguments like this:

   Log::Log4perl -> get_logger() -> debug("Parsing start"):
   ...
   Log::Log4perl -> get_logger() -> debug("Done, ", $error_count, " 
errors.");

Using this sort of code with Log::Log4perl::Appender::DBI the way it's 
currently suggested/recommended by the perldoc (prepared statements, '?' 
placeholders and warp_message=0) is presently a poor experience, because 
the number of placeholders is variable.  At the moment this means most 
of my DBI inserts were failing silently and I had to uncomment the 
"warn" on line 138 of Log::Log4perl::Appender::DBI to find out what was 
going wrong (which is rather unfortunate.)

I think it would be better to do something like this as a default in the 
perldoc example (ie. without warp_message, and %m explicitly specified 
as a parameter)

  log4perl.appender.DBLog = Log::Log4perl::Appender::DBI
  log4perl.appender.DBLog.datasource = DBI:mysql:database=log;host=localhost
  log4perl.appender.DBLog.username = user
  log4perl.appender.DBLog.password = pass
  log4perl.appender.DBLog.sql = insert into cc3 (timestamp, severity, 
source, source_line, host, caller, file, message) values 
(unix_timestamp(), ?, ?, ?, ?, ?, ?, ?);
  log4perl.appender.DBLog.params.1 = %p
  log4perl.appender.DBLog.params.2 = %X{source}
  log4perl.appender.DBLog.params.3 = %X{source-line}
  log4perl.appender.DBLog.params.4 = %H
  log4perl.appender.DBLog.params.5 = %M
  log4perl.appender.DBLog.params.6 = +%L %F
  log4perl.appender.DBLog.params.7 = %m
  log4perl.appender.DBLog.usePreparedStmt = 1
  log4perl.appender.DBLog.layout = Log::Log4perl::Layout::NoopLayout

The existing example could then be included in the perldoc under a 
section entitled ("How to get access to individual arguments to debug(), 
warn() etc.")

But it's a great class nevertheless :)

Thanks,
A.

-- 
Adrian Corston
Support Engineer
YourAmigo

IMPORTANT - This email message is for the sole use of the intended recipient(s) 
and may contain confidential and privileged information in which case neither 
is intended to be waived. YourAmigo retains ownership of all copyright, trade 
secrets and other intellectual property rights in the email and attachments. 
Any unauthorized review, use, disclosure or distribution is prohibited. If you 
are not the intended recipient, please notify us and remove it from your 
system. It is your responsibility to check any attachments for viruses and 
defects before opening or sending them on. YourAmigo collects personal 
information to provide and market our services. For more information about use, 
disclosure and access, see our privacy policy at http://www.youramigo.com


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to