You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently each gorm object needs to have the auditable value set. Would be easier and more consistent to set a global default auditable state in Config.groovy that gets applied to all objects. This is helpful if you can not modify all gorm objects but want universal logging, have a lot of gorm objects to modify, or want to ensure future compliance. Each gorm object can over-ride the default behavior to change/turn it off the same as current configuration for audit logging.
The provided patch is consistent with the current behavior if Config.groovy does not get added defaults. Then modifying Config.groovy will allow setting the 4 main settings of audit logging via different parameters.
Example of new Config.groovy settings allowed from this patch:
auditLog {
auditableDefault = true
handlersOnlyDefault = true
ignoreDefault = ['version','lastUpdated','ignoreMe']
defaultHandlerClosure = { request, session, handler, entity, oldMap, newMap ->
print "Handler called for ${entity.class.toString()} object due to change of ${handler}"
}
}
auditableDefault - can be true or false. If false (standard behavior) will only log for classes with static auditable defined. If true then will log for any class that does not set static auditable = false.
handlersOnlyDefault - can be true or false. If false (standard behavior) will continue to log as normal. If true will not carry out the logging except on any class with static auditable = [handlersOnly:false]
ignoreDefault - takes a list that will be the default fields ignored. If not provided will be ['version', 'lastUpdated'] like the current version. Like other properties setting ignore: in the static auditable will use that over the default.
defaultHandlerClosure - A closure that will be called if the gorm object does not have the proper on method (onChange, onSave, onDelete). The closure takes 5 parameters as shown in above example. The handler value will be a string equal to the on method that was not provided.
The text was updated successfully, but these errors were encountered:
Original Reporter: eceres
Environment: Not Specified
Version: Grails-AuditLogging 0.5.4
Migrated From: http://jira.grails.org/browse/GPAUDITLOGGING-35
Currently each gorm object needs to have the auditable value set. Would be easier and more consistent to set a global default auditable state in Config.groovy that gets applied to all objects. This is helpful if you can not modify all gorm objects but want universal logging, have a lot of gorm objects to modify, or want to ensure future compliance. Each gorm object can over-ride the default behavior to change/turn it off the same as current configuration for audit logging.
The provided patch is consistent with the current behavior if Config.groovy does not get added defaults. Then modifying Config.groovy will allow setting the 4 main settings of audit logging via different parameters.
Example of new Config.groovy settings allowed from this patch:
auditLog {
auditableDefault = true
handlersOnlyDefault = true
ignoreDefault = ['version','lastUpdated','ignoreMe']
defaultHandlerClosure = { request, session, handler, entity, oldMap, newMap ->
print "Handler called for ${entity.class.toString()} object due to change of ${handler}"
}
}
auditableDefault - can be true or false. If false (standard behavior) will only log for classes with static auditable defined. If true then will log for any class that does not set static auditable = false.
handlersOnlyDefault - can be true or false. If false (standard behavior) will continue to log as normal. If true will not carry out the logging except on any class with static auditable = [handlersOnly:false]
ignoreDefault - takes a list that will be the default fields ignored. If not provided will be ['version', 'lastUpdated'] like the current version. Like other properties setting ignore: in the static auditable will use that over the default.
defaultHandlerClosure - A closure that will be called if the gorm object does not have the proper on method (onChange, onSave, onDelete). The closure takes 5 parameters as shown in above example. The handler value will be a string equal to the on method that was not provided.
The text was updated successfully, but these errors were encountered: