10

I am a newbie for log4j and sl4j, I am using grails 2.0.4 and in config.groovy there is a line

grails.logging.jul.usebridge = false for prod

&

grails.logging.jul.usebridge = true for dev

I followed this article, As it says that use of grails.logging.jul.usebridge is to implement the swapping logic of logging frameworks such as

  • log4j
  • java.util.logging
  • commons logging
  • logback

Is this the only use of grails.logging.jul.usebridge in config.groovy, or is there any other uses

And one more question

  1. which is the recommended logging framework to use in production environment
Maicon Mauricio
  • 2,052
  • 1
  • 13
  • 29
n92
  • 7,424
  • 27
  • 93
  • 129

1 Answers1

7

I definitely recommend you using Log4j. It has no dependencies and is tested (or even included) in various web app servers. You can configure it easily via DSL in Config.groovy or in separate config file in production environment.

Both commons-logging and SLF4J are wrappers for Log4j and use it underneath.

The grails.logging.jul.usebridge = true is used to put java.util.logging through SLF4J, as described here.

Piotr Jagielski
  • 368
  • 2
  • 6
  • 4
    It should be noted however that official documentation warns about the performance issues of using `grails.logging.jul.usebridge = true` in production environments: * [slf4j web site](http://www.slf4j.org/legacy.html#jul-to-slf4j) and * [Grails web site](http://grails.org/1.3.5+Release+Notes) – David Riccitelli Oct 17 '12 at 14:48
  • 1
    **Please note**: SLF4J is *not* a "log4j wrapper" in any way, shape or form. These are dang lies. SLF4J is a logging API that has a binding for log4j (if that's what you choose to use), but also has bindings for lots of other things: logback, JUL, JCL, etc. – smeeb Mar 13 '15 at 18:44
  • as @DavidRiccitelli said it had caused serious performance issues on our production servers. Set it to false resolved the problem. – Nico Feb 22 '16 at 17:18