【问题标题】:Store logs in mongo instead of mysql(hibernate)将日志存储在 mongo 而不是 mysql(hibernate) 中
【发布时间】:2014-08-06 08:20:19
【问题描述】:

我目前正在尝试使用这个插件:http://grails.org/plugin/audit-logging

我想将我的日志直接存储在 mongoDB 中。我成功地使用了 hibernate 和 mongo(同时),通过使用:static mapWith = "mongo" 在我的其他域中的类似属性。

其实我的日志是存储在mysql中的。我喜欢将此日志存储在 mongo 中。

可以切换数据源吗?

【问题讨论】:

    标签: hibernate mongodb grails groovy grails-orm


    【解决方案1】:

    看着source code

    def doWithApplicationContext = { applicationContext ->
        application.mainContext.eventTriggeringInterceptor.datastores.each { key, datastore ->
            // Don't register the listener if we are disabled
            if (!application.config.auditLog.disabled && !datastore.config.auditLog.disabled) {
    

    尝试将以下内容添加到您的 DataSource.groovy:

     dataSource {
       ...
       auditLog.disabled = true
     }
    
     mongo {
       ...
       auditLog.disabled = false
     }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-30
      • 1970-01-01
      • 1970-01-01
      • 2018-12-19
      • 1970-01-01
      • 1970-01-01
      • 2011-01-18
      • 2021-09-28
      相关资源
      最近更新 更多