[coldbox-3.5.2] LogBox: DBAppender Bug

I think there is a bug in logging.appenders.DBAppender.cfc

It doesn’t seem to respect a custom columnMap.

May I suggest the following change around line 187…

for(key in map){
if( listFindNoCase(instance.columns,key) ){
instance.columns = listSetAt(instance.columns, listFindNoCase(instance.columns,key), map[key]);
} else {
$throw(message=“Invalid column map key: #key#”,detail=“The available keys are #instance.columns#”,type=“DBAppender.InvalidColumnMapException”);
}
}

I’ve added a line to update the list elements of the instance.columns var which have been renamed.

Anyone else experienced this or agree with this update?

Richard, check the following, this is where we do the switch:

// Column Maps

if( propertyExists(‘columnMap’) ){

cmap = getProperty(‘columnMap’);

cols = “#cmap.id#,#cmap.severity#,#cmap.category#,#cmap.logdate#,#cmap.appendername#,#cmap.message#,#cmap.extrainfo#”;

}

else{

cols = instance.columns;

}

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Sorry, I should have expanded on my posting.

The issue is with the db table creation around line 160 where it uses the “cols” list from “instance.columns”.

On that point I have another couple of issues.

I think…

PRIMARY KEY (id)

…should be changed to…

PRIMARY KEY (#listgetAt(cols,1)#)

…and I have an issue with …

#listgetAt(cols,4)# DATETIME NOT NULL,

…as I’m on Oracle and it doesn’t have DATETIME as a date datatype only TIMESTAMP so I’m guessing there needs to be conditional test on the db type to determine if to use DATETIME or TIMESTAMP.

If my understanding is right, do you want me to code something up for you to consider?

Yes definitely Richard, I see this now. Also, maybe the coldbox.system.cache.store.JDBCStore can guide you as it has all the different things for other DB’s. This could be a good addition for a patch release.

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

I’m happy to take this patch on as I’ve already done most of the work.

Only issue is that at work they are on SVN so I need to get my head around the Git fork/pull request workflow from home.

I assume this is not a drop-dead-now fix so I’ll get to it as soon as I can, if that’s okay?

Richard, I have exactly the same problem with oracle. could post the patch here?
Daniel