审计日志管理服务
| Modifiers | Name | Description |
|---|---|---|
static Integer |
aliasOverridingOrder |
|
static Set<String> |
auditableDomainClassesCreate |
需自动监控的Domain类缓存 |
static Set<String> |
auditableDomainClassesDelete |
|
static Set<String> |
auditableDomainClassesUpdate |
| Fields inherited from class | Fields |
|---|---|
class bropen.framework.plugins.auditlog.AuditlogService |
aliasOverridingOrder, __$stMC, $ins$1grails_plugins_mail_SendMail__applicationContext, $0x001abropen_toolkit_traits_TagInvokerTrait__DEFAULT_NS, $static$1bropen_toolkit_traits_TagInvokerTrait__DEFAULT_NS, $0x000abropen_toolkit_traits_TagInvokerTrait__tagLibraryLookup, $static$1bropen_toolkit_traits_TagInvokerTrait__tagLibraryLookup, $0x000abropen_toolkit_traits_events_SyncEvents__syncEventBus, $static$1bropen_toolkit_traits_events_SyncEvents__syncEventBus, $0x000abropen_toolkit_traits_events_SyncEvents__syncEventReceivers, $static$1bropen_toolkit_traits_events_SyncEvents__syncEventReceivers, $0x000abropen_toolkit_traits_events_SyncEvents__syncEventReceiverClosures, $static$1bropen_toolkit_traits_events_SyncEvents__syncEventReceiverClosures, $0x000abropen_toolkit_traits_events_Events__eventBus, $static$1bropen_toolkit_traits_events_Events__eventBus, $0x000abropen_toolkit_traits_events_Events__eventReceivers, $static$1bropen_toolkit_traits_events_Events__eventReceivers, $0x000abropen_toolkit_traits_events_Events__eventReceiverClosures, $static$1bropen_toolkit_traits_events_Events__eventReceiverClosures, $static$1bropen_grails_ExecutorTrait__svc, $ins$1grails_events_Events__eventBus |
| Type | Name and description |
|---|---|
bropen.framework.core.SettingService |
settingService |
grails.plugin.springsecurity.SpringSecurityService |
springSecurityService |
| Type | Name and description |
|---|---|
boolean |
addAccessLog(javax.servlet.http.HttpServletRequest request = null, Map options = null)添加一条访问日志。 |
boolean |
addAccessLog(String method, String uri, Object params, Map dataExt = null)添加一条访问日志。 |
boolean |
addDataCreateLog(String code, Map newValues, Object bean = null)添加一条数据新增日志。 |
boolean |
addDataDeleteLog(String code, Map oldValues, Object bean = null)添加一条数据删除日志。 |
boolean |
addDataLogForHibEvent(Object bean, String dataLevel, Map oldValues, Map newValues)通过 Hibernate 事件自动监控 Domain 类时,添加一条新日志。 |
boolean |
addDataUpdateLog(String code, Map oldValues, Map newValues, Object bean = null)添加一条数据修改日志。 |
boolean |
addErrorLog(String message, Throwable exception)添加一条错误日志。 |
boolean |
addExecuteLog(String code, String executeClass, String message, Object vars)添加一条执行日志。 |
boolean |
addExecuteLog(String code, String executeClass, Object bean, String message, Object vars)添加一条执行日志。 |
boolean |
addLoginLog()添加一条用户登录日志。 |
void |
bootStrapInit()系统启动时,初始化服务 |
void |
deleteAuditlogs(String clazz, String hqlWhere)删除审计日志 |
boolean |
dumpAuditlogs(String clazz, String hqlWhere, Long maxRows = null)将审计日志转储到文件系统中。 |
List |
executeQuery(String hql, List queryParams, Map metaParams) |
List<AuditlogConfig> |
getMatchedAccessLogConfigs(String uri)根据 URI 获得匹配的日志配置对象列表 |
Boolean |
isEnabled()是否启用了审计日志 |
void |
reloadConfigs()重新加载所有日志配置 |
| Methods inherited from class | Name |
|---|---|
class bropen.framework.plugins.auditlog.AuditlogService |
bropen.framework.plugins.auditlog.AuditlogService#addAccessLog(String, String, Object), bropen.framework.plugins.auditlog.AuditlogService#addAccessLog(), bropen.framework.plugins.auditlog.AuditlogService#addAccessLog(javax.servlet.http.HttpServletRequest, Map), bropen.framework.plugins.auditlog.AuditlogService#addAccessLog(javax.servlet.http.HttpServletRequest), bropen.framework.plugins.auditlog.AuditlogService#addAccessLog(String, String, Object, Map), bropen.framework.plugins.auditlog.AuditlogService#reloadConfigs(), bropen.framework.plugins.auditlog.AuditlogService#addExecuteLog(String, String, Object, String, Object), bropen.framework.plugins.auditlog.AuditlogService#addExecuteLog(String, String, String, Object), bropen.framework.plugins.auditlog.AuditlogService#addDataCreateLog(String, Map, Object), bropen.framework.plugins.auditlog.AuditlogService#addDataCreateLog(String, Map), bropen.framework.plugins.auditlog.AuditlogService#addDataUpdateLog(String, Map, Map, Object), bropen.framework.plugins.auditlog.AuditlogService#addDataUpdateLog(String, Map, Map), bropen.framework.plugins.auditlog.AuditlogService#getMatchedAccessLogConfigs(String), bropen.framework.plugins.auditlog.AuditlogService#addDataDeleteLog(String, Map, Object), bropen.framework.plugins.auditlog.AuditlogService#addDataDeleteLog(String, Map), bropen.framework.plugins.auditlog.AuditlogService#addErrorLog(String, Throwable), bropen.framework.plugins.auditlog.AuditlogService#addLoginLog(), bropen.framework.plugins.auditlog.AuditlogService#invokeTag(String), bropen.framework.plugins.auditlog.AuditlogService#invokeTag(String, Map, Closure), bropen.framework.plugins.auditlog.AuditlogService#invokeTag(String, Map), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_TagInvokerTrait__DEFAULT_NS$get(), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_TagInvokerTrait__tagLibraryLookup$get(), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_TagInvokerTrait__DEFAULT_NS$set(String), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_TagInvokerTrait__tagLibraryLookup$set(org.grails.taglib.TagLibraryLookup), bropen.framework.plugins.auditlog.AuditlogService#bropen_grails_ExecutorTraittrait$super$getExecutorService(), bropen.framework.plugins.auditlog.AuditlogService#callAsync(Closure), bropen.framework.plugins.auditlog.AuditlogService#bropen_grails_ExecutorTraittrait$super$callAsync(Closure), bropen.framework.plugins.auditlog.AuditlogService#runAsync(Runnable), bropen.framework.plugins.auditlog.AuditlogService#bropen_grails_ExecutorTraittrait$super$runAsync(Runnable), bropen.framework.plugins.auditlog.AuditlogService#bropen_grails_ExecutorTrait__svc$get(), bropen.framework.plugins.auditlog.AuditlogService#bropen_grails_ExecutorTrait__svc$set(grails.plugin.executor.PersistenceContextExecutorWrapper), bropen.framework.plugins.auditlog.AuditlogService#grails_plugins_mail_SendMailtrait$super$getApplicationContext(), bropen.framework.plugins.auditlog.AuditlogService#grails_plugins_mail_SendMailtrait$super$setApplicationContext(org.springframework.context.ApplicationContext), bropen.framework.plugins.auditlog.AuditlogService#sendMail(Closure), bropen.framework.plugins.auditlog.AuditlogService#grails_plugins_mail_SendMailtrait$super$sendMail(Closure), bropen.framework.plugins.auditlog.AuditlogService#grails_plugins_mail_SendMail__applicationContext$get(), bropen.framework.plugins.auditlog.AuditlogService#grails_plugins_mail_SendMail__applicationContext$set(org.springframework.context.ApplicationContext), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_ServletTraittrait$super$getSession(), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_ServletTraittrait$super$getRequest(), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_ServletTraittrait$super$getResponse(), bropen.framework.plugins.auditlog.AuditlogService#notifySync(CharSequence, Object), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_SyncEventstrait$super$notifySync(CharSequence, Object), bropen.framework.plugins.auditlog.AuditlogService#sendAndReceiveSync(CharSequence, Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_SyncEventstrait$super$sendAndReceiveSync(CharSequence, Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#sendAndReceiveAllSync(CharSequence, Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_SyncEventstrait$super$sendAndReceiveAllSync(CharSequence, Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#receiveAllSync(CharSequence, Closure), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_SyncEventstrait$super$receiveAllSync(CharSequence, Closure), bropen.framework.plugins.auditlog.AuditlogService#clearSyncEventConsumers(CharSequence), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_SyncEventstrait$super$clearSyncEventConsumers(CharSequence), bropen.framework.plugins.auditlog.AuditlogService#onSync(CharSequence, Closure), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_SyncEventstrait$super$onSync(CharSequence, Closure), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_SyncEvents__syncEventReceiverClosures$get(), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_SyncEvents__syncEventReceivers$get(), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_SyncEvents__syncEventBus$get(), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_SyncEvents__syncEventBus$set(reactor.bus.EventBus), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_SyncEvents__syncEventReceivers$set(Hashtable), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_SyncEvents__syncEventReceiverClosures$set(Hashtable), bropen.framework.plugins.auditlog.AuditlogService#receiveAll(CharSequence, Closure), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_Eventstrait$super$receiveAll(CharSequence, Closure), bropen.framework.plugins.auditlog.AuditlogService#sendAndReceiveAll(CharSequence, Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_Eventstrait$super$sendAndReceiveAll(CharSequence, Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_Events__eventReceiverClosures$get(), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_Events__eventReceivers$get(), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_Events__eventBus$get(), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_Events__eventBus$set(reactor.bus.EventBus), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_Events__eventReceivers$set(Hashtable), bropen.framework.plugins.auditlog.AuditlogService#bropen_toolkit_traits_events_Events__eventReceiverClosures$set(Hashtable), bropen.framework.plugins.auditlog.AuditlogService#clearEventConsumers(Object), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$clearEventConsumers(Object), bropen.framework.plugins.auditlog.AuditlogService#getEventBus(), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$getEventBus(), bropen.framework.plugins.auditlog.AuditlogService#setEventBus(reactor.bus.EventBus), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$setEventBus(reactor.bus.EventBus), bropen.framework.plugins.auditlog.AuditlogService#sendAndReceive(Object, Closure, Closure), bropen.framework.plugins.auditlog.AuditlogService#sendAndReceive(Object, Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$sendAndReceive(Object, Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$sendAndReceive(Object, Closure, Closure), bropen.framework.plugins.auditlog.AuditlogService#eventFor(Object), bropen.framework.plugins.auditlog.AuditlogService#eventFor(Map, Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#eventFor(Map, Object), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$eventFor(Map, Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$eventFor(Object), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$eventFor(Map, Object), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$on(Object, reactor.fn.Consumer), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$on(Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$on(Class, reactor.fn.Consumer), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$on(Class, Closure), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$on(reactor.bus.selector.Selector, Closure), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$on(reactor.bus.selector.Selector, reactor.fn.Consumer), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$notify(Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$notify(Object, reactor.bus.Event), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Eventstrait$super$notify(Object, Object), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Events__eventBus$get(), bropen.framework.plugins.auditlog.AuditlogService#grails_events_Events__eventBus$set(reactor.bus.EventBus), bropen.framework.plugins.auditlog.AuditlogService#getResponse(), bropen.framework.plugins.auditlog.AuditlogService#setMetaClass(MetaClass), bropen.framework.plugins.auditlog.AuditlogService#getMetaClass(), bropen.framework.plugins.auditlog.AuditlogService#getApplicationContext(), bropen.framework.plugins.auditlog.AuditlogService#setApplicationContext(org.springframework.context.ApplicationContext), bropen.framework.plugins.auditlog.AuditlogService#getExecutorService(), bropen.framework.plugins.auditlog.AuditlogService#getSession(), bropen.framework.plugins.auditlog.AuditlogService#getRequest(), bropen.framework.plugins.auditlog.AuditlogService#executeQuery(String, List, Map), bropen.framework.plugins.auditlog.AuditlogService#isEnabled(), bropen.framework.plugins.auditlog.AuditlogService#on(Object, reactor.fn.Consumer), bropen.framework.plugins.auditlog.AuditlogService#on(Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#on(reactor.bus.selector.Selector, Closure), bropen.framework.plugins.auditlog.AuditlogService#on(Class, reactor.fn.Consumer), bropen.framework.plugins.auditlog.AuditlogService#on(Class, Closure), bropen.framework.plugins.auditlog.AuditlogService#on(reactor.bus.selector.Selector, reactor.fn.Consumer), bropen.framework.plugins.auditlog.AuditlogService#invokeMethod(String, Object), bropen.framework.plugins.auditlog.AuditlogService#setProperty(String, Object), bropen.framework.plugins.auditlog.AuditlogService#getProperty(String), bropen.framework.plugins.auditlog.AuditlogService#notify(Object, Closure), bropen.framework.plugins.auditlog.AuditlogService#notify(Object, reactor.bus.Event), bropen.framework.plugins.auditlog.AuditlogService#notify(Object, Object), bropen.framework.plugins.auditlog.AuditlogService#m(Map), bropen.framework.plugins.auditlog.AuditlogService#wait(long, int), bropen.framework.plugins.auditlog.AuditlogService#wait(long), bropen.framework.plugins.auditlog.AuditlogService#wait(), bropen.framework.plugins.auditlog.AuditlogService#equals(Object), bropen.framework.plugins.auditlog.AuditlogService#toString(), bropen.framework.plugins.auditlog.AuditlogService#hashCode(), bropen.framework.plugins.auditlog.AuditlogService#getClass(), bropen.framework.plugins.auditlog.AuditlogService#notify(), bropen.framework.plugins.auditlog.AuditlogService#notifyAll() |
class Object |
Object#wait(long, int), Object#wait(long), Object#wait(), Object#equals(Object), Object#toString(), Object#hashCode(), Object#getClass(), Object#notify(), Object#notifyAll() |
需自动监控的Domain类缓存
添加一条访问日志。
options - 其他需要记录的信息,默认都是从 request 中计算options.method - 访问方法,如 GET、POSToptions.uri - 访问的 URI 地址options.params - 请求参数options.dataId - 请求的数据 ID,默认从请求参数中取 idoptions.dataClass - 请求的数据 Domain 类,默认根据脚手架控制器计算添加一条访问日志。
method - 请求方法,如 GET、POSTuri - 请求的URI地址params - 参数 Map 或 Body String添加一条数据新增日志。
code - 审计日志配置文件的代码添加一条数据删除日志。
code - 审计日志配置文件的代码通过 Hibernate 事件自动监控 Domain 类时,添加一条新日志。
dataLevel - 数据操作方式oldValues - 原数据newValues - 新数据添加一条数据修改日志。
code - 审计日志配置文件的代码添加一条错误日志。
message - 错误消息exception - 错误实体添加一条执行日志。
code - 日志配置唯一标识executeClass - 当前类名称message - 执行消息vars - 需记录的环境变量与参数等添加一条执行日志。
code - 日志配置唯一标识executeClass - 当前类名称bean - 关联对象message - 执行消息vars - 需记录的环境变量与参数等添加一条用户登录日志。
系统启动时,初始化服务
删除审计日志
clazz - 审计日志类的全名hqlWhere - 查询条件,即:where ....将审计日志转储到文件系统中。
如果是从job中、或者transactional为false的service中调用,必须先初始化一个hibernate session(xx.withNewSession),以免异常。
clazz - 审计日志类的全名hqlWhere - 查询条件,即:where ....maxRows - 做多转储日志条数,默认为50w条根据 URI 获得匹配的日志配置对象列表
是否启用了审计日志
重新加载所有日志配置