Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBI appender max_col_size not applied to binds outside params #103

Open
bnweiss opened this issue Dec 3, 2020 · 1 comment
Open

DBI appender max_col_size not applied to binds outside params #103

bnweiss opened this issue Dec 3, 2020 · 1 comment

Comments

@bnweiss
Copy link

bnweiss commented Dec 3, 2020

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".

#handle leftovers

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.

@mohawk2
Copy link
Collaborator

mohawk2 commented Jun 1, 2022

If you make a PR, I believe that will make things be clearer :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants