Open bnweiss opened 3 years ago
A configuration like so will not apply the max_col_size option and truncate the 7th bind field [message]:
log4perl.appender.DBI.sql = INSERT INTO log(logDate, filename, lineNum, logLevel, ip, userNum,message) VALUES (?,?,?,?,?,?,?) log4perl.appender.DBI.params.1 = %d{yyyy-MM-dd HH:mm:ss} log4perl.appender.DBI.params.2 = %F log4perl.appender.DBI.params.3 = %L log4perl.appender.DBI.params.4 = %p log4perl.appender.DBI.params.5 = %X{ip} log4perl.appender.DBI.params.6 = %X{user} log4perl.appender.DBI.usePreparedStmt = 1 log4perl.appender.DBI.layout = Log::Log4perl::Layout::NoopLayout log4perl.appender.DBI.warp_message = 0 log4perl.appender.DBI.max_col_size = 10
You can see in the code that the max_col_size is never applied to the "leftovers". https://github.com/mschilli/log4perl/blob/a361622da0a110d16a7efd61dab23c0d7a475eec/lib/Log/Log4perl/Appender/DBI.pm#L255
If I change the order of my binds however the max_col_size will be applied to the message field -
log4perl.appender.DBI.sql = INSERT INTO log(logDate, filename, lineNum, logLevel, ip, message, usernum) VALUES (?,?,?,?,?,?,?) log4perl.appender.DBI.params.1 = %d{yyyy-MM-dd HH:mm:ss} log4perl.appender.DBI.params.2 = %F log4perl.appender.DBI.params.3 = %L log4perl.appender.DBI.params.4 = %p log4perl.appender.DBI.params.5 = %X{ip} log4perl.appender.DBI.params.7 = %X{user} log4perl.appender.DBI.usePreparedStmt = 1 log4perl.appender.DBI.layout = Log::Log4perl::Layout::NoopLayout log4perl.appender.DBI.warp_message = 0 log4perl.appender.DBI.max_col_size = 10
Easy to fix and make a PR but I'm not sure if I am missing something else with how things are meant to work.
If you make a PR, I believe that will make things be clearer :-)
A configuration like so will not apply the max_col_size option and truncate the 7th bind field [message]:
You can see in the code that the max_col_size is never applied to the "leftovers". https://github.com/mschilli/log4perl/blob/a361622da0a110d16a7efd61dab23c0d7a475eec/lib/Log/Log4perl/Appender/DBI.pm#L255
If I change the order of my binds however the max_col_size will be applied to the message field -
Easy to fix and make a PR but I'm not sure if I am missing something else with how things are meant to work.