3

有人成功了吗?我正在尝试在 Config.groovy 中制作一些东西,但它不起作用。这是我的代码:

log4j = {
    appenders {
        console name:'console',
        layout:pattern(conversionPattern: '%d %-5p [%t] %c %x -%m%n')
        appender new org.graylog2.log.GelfAppender(
                name:'gelf',
                graylogHost:'my_graylog_host',
                graylogPort: graylog_port,
                facility: 'myService',
                extractStacktrace: true,
                threshold: org.apache.log4j.Level.DEBUG
                )
        info additivity: false
    }
}
4

1 回答 1

1

我在 Grails 1.3.7 中成功登录到 graylog2,其中包含以下内容Config.groovy

log4j = {
    appenders {
        appender new org.graylog2.log.GelfAppender(
            name: 'gelfAppender',
            graylogHost: 'graylog.example.com',
            extractStacktrace: true,
            addExtendedInformation: true,
            includeLocation: false
        )
    }

    root {
        error 'gelfAppender'
    }
}
于 2015-06-11T19:52:48.593 回答