I configured a root level File logger and
a DBI appender. the %m is shown correctly in the file, but as stringified array ref in the
column associated with %m in the db (mysql).
I tried warp_message = 0 and tried assigning a
sub to return a scalar, but it still ends up
as a stringified array ref in the DB record??
I must have a typo or a misunderstanding, but
can't find it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually, it's strange, a config with typos
in the sql params assignment does insert records
( I had 2 params.9 = ! ) It also seems not
to put %m in as a string even if i use a sub to
return a scalar)
When I tried various alternate placeholder stmts,
still didn't work for me (although the File
appender works fine)
Here's my info:
Contents:
I. schema for log table
II. Conf file with the typo that inserts broken
records. (all my other variations wouldn't
enter records)
II. Malformed config that does insert
########################################################################################################################################################################
# Define the top level 'root' logger:
#
#define the logger to be inherited by subclasses of BPTest
log4perl.category.BPTest.BPTestXML_RPC = ERROR
###########################################################################################
# Define the MySQL appender which logs to the log table in the QA database
# The category is set to the top of the hierarchy, so all WARN an d higher log events
# will be recorded in the database.
# To narrow the category logged add more specific members to : log4j.category declaration :
# (Log4perl can use log4j config syntax, hence 'log4j' below: )
#just pass through the array of message items in the log statement
log4j.appender.DBAppndr.layout = Log::Log4perl::Layout::NoopLayout
log4j.appender.DBAppndr.warp_message = 0
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I configured a root level File logger and
a DBI appender. the %m is shown correctly in the file, but as stringified array ref in the
column associated with %m in the db (mysql).
I tried warp_message = 0 and tried assigning a
sub to return a scalar, but it still ends up
as a stringified array ref in the DB record??
I must have a typo or a misunderstanding, but
can't find it.
Where's your L4p configuration?
Actually, it's strange, a config with typos
in the sql params assignment does insert records
( I had 2 params.9 = ! ) It also seems not
to put %m in as a string even if i use a sub to
return a scalar)
When I tried various alternate placeholder stmts,
still didn't work for me (although the File
appender works fine)
Here's my info:
Contents:
I. schema for log table
II. Conf file with the typo that inserts broken
records. (all my other variations wouldn't
enter records)
I.
mysql> describe log;
+----------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | | PRI | NULL | auto_increment |
| level | varchar(255) | | | | |
| priority | varchar(255) | YES | | NULL | |
| message | text | | | | |
| date | datetime | YES | | NULL | |
| deltat | int(11) | YES | | NULL | |
| host | varchar(255) | YES | | NULL | |
| pid | int(11) | YES | | NULL | |
| file | varchar(255) | YES | | NULL | |
| line | int(11) | YES | | NULL | |
| method | varchar(255) | YES | | NULL | |
+----------+------------------+------+-----+---------+----------------+
id level priority message date deltat host pid file line method
1 main ERROR ARRAY(0x84d148c) 2006-03-28 16:48:40 64 vm-esilber-40 20415 ./run_api_test 0 HELLO
2 BPTestXML_RPC ERROR ARRAY(0x85eb484) 2006-03-28 16:48:40 64 vm-esilber-40 20415 BPTest.pm 0 BPTEST
3 BPTestXML_RPC ERROR ARRAY(0x85f5f0c) 2006-03-28 16:48:40 64 vm-esilber-40 20415 BPTestXML_RPC.pm 0 ------>XXXX BPTest
II. Malformed config that does insert
########################################################################################################################################################################
# Define the top level 'root' logger:
#
log4perl.rootLogger=ERROR, LOGFILE
log4perl.appender.LOGFILE=Log::Log4perl::Appender::File
log4perl.appender.LOGFILE.filename=/opt/cvs/qa/apitest/src/apitest.log
log4perl.appender.LOGFILE.mode=append
log4perl.appender.LOGFILE.layout=PatternLayout
log4perl.appender.LOGFILE.layout.ConversionPattern=LogEventPri:%-5p Category:%c Package:%C %d deltaT(millisec):%-4r PID:%P HOST:%H File:%F METHOD:%l LINE:%L %x - %m%n
#define the logger to be inherited by subclasses of BPTest
log4perl.category.BPTest.BPTestXML_RPC = ERROR
###########################################################################################
# Define the MySQL appender which logs to the log table in the QA database
# The category is set to the top of the hierarchy, so all WARN an d higher log events
# will be recorded in the database.
# To narrow the category logged add more specific members to : log4j.category declaration :
# (Log4perl can use log4j config syntax, hence 'log4j' below: )
log4j.category = WARN, DBAppndr
log4j.appender.DBAppndr = Log::Log4perl::Appender::DBI
log4j.appender.DBAppndr.datasource = DBI:mysql:QA
log4j.appender.DBAppndr.username = esilber
log4j.appender.DBAppndr.password =
log4j.appender.DBAppndr.sql = \ insert into log \ ( priority, level, message, date,deltat, host, pid, file, line, method ) \ values (?,?,?,?,?,?,?,?,?,?)
log4j.appender.DBAppndr.params.1 = %p
log4j.appender.DBAppndr.params.2 = %c
log4j.appender.DBAppndr.params.3 = %m
log4j.appender.DBAppndr.params.4 = %d
log4j.appender.DBAppndr.params.5 = %r
log4j.appender.DBAppndr.params.6 = %H
log4j.appender.DBAppndr.params.7 = %P
log4j.appender.DBAppndr.params.8 = %F
log4j.appender.DBAppndr.params.9 = %L
log4j.appender.DBAppndr.params.9 = %M
log4j.appender.DBAppndr.bufferSize = 2
#just pass through the array of message items in the log statement
log4j.appender.DBAppndr.layout = Log::Log4perl::Layout::NoopLayout
log4j.appender.DBAppndr.warp_message = 0