Configuring graylog2 for grails

502 Views Asked by At

Has anyone succeeded in this? I am trying to make something in Config.groovy but it is not working. Here is my code:

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
    }
}
1

There are 1 best solutions below

0
On

I am successfully logging to graylog2 in Grails 1.3.7 with the following in my 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'
    }
}