Grails
  1. Grails
  2. GRAILS-6566

Make logging DSL simpler for new users

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.3.3
    • Fix Version/s: 3.0
    • Component/s: Configuration
    • Labels:
      None

      Description

      I think the current logging configuration is confusing, particularly for new users. Simplification would remove a major bugbear for users. Here's an initial proposal:

      grails.logging = {
         defaultLevel info // One of: off, error, warn, info, debug, trace
      
         stdout = console format: "..."
         stacktrace = rollingFile file: "..."
         otherLog = socket ...
      
         service debug, "reportService"
         services warn, "securityService", "blogService"
      
         controllers to: otherLog, trace, "postController", "userController"
      
         web off           // Grails web-related stuff
         spring warn     // Spring-related classes
         gorm debug
      
         packages to: stdout, info, "org.codehaus.groovy.grails", "grails.spring"
      }
      

      There was plenty of discussion about this on the developer mailing list:

      http://grails.1312388.n4.nabble.com/Proposal-for-new-logging-DSL-td2288326.html

      I'm raising this issue to see whether there is enough demand for this change. If the number of votes remains low, then it's not worth implementing, but if there are a lot of votes, we should consider making changes. This is also a good place to collate user feedback and suggestions on the proposal.

        Issue Links

          Activity

          Hide
          Rich Kroll added a comment -

          I think there is a great convenience factor to having some of your suggested 'container' log settings for lack of a better word. I know from first hand experience that some of the frustration comes with trying to turn up the log level for your code - be it controller, service, etc. Coming from Java, I expected something like 'com.mycompany' to turn up the log level for my components, even though they were grails artifacts and have since learned that to achieve this effect I need to turn on 'grails.app.service/domain/etc'. This is an often cited source of confusion for many users. Perhaps in addition to making the DSL simpler, we could weave 'com.mycompany' into 'grails.app.service.com.mycompany' so that the users expected behavior would happen while keeping backwards compatibility?

          Show
          Rich Kroll added a comment - I think there is a great convenience factor to having some of your suggested 'container' log settings for lack of a better word. I know from first hand experience that some of the frustration comes with trying to turn up the log level for your code - be it controller, service, etc. Coming from Java, I expected something like 'com.mycompany' to turn up the log level for my components, even though they were grails artifacts and have since learned that to achieve this effect I need to turn on 'grails.app.service/domain/etc'. This is an often cited source of confusion for many users. Perhaps in addition to making the DSL simpler, we could weave 'com.mycompany' into 'grails.app.service.com.mycompany' so that the users expected behavior would happen while keeping backwards compatibility?
          Hide
          Peter Ledbrook added a comment -

          Somebody also made the point that you cannot selectively override parts of the configuration. You have to provide the whole log4j closure in external config files and the like. It would be much better to allow for selective overriding. Perhaps basing the configuration on logback's Groovy DSL would help.

          Show
          Peter Ledbrook added a comment - Somebody also made the point that you cannot selectively override parts of the configuration. You have to provide the whole log4j closure in external config files and the like. It would be much better to allow for selective overriding. Perhaps basing the configuration on logback's Groovy DSL would help.

            People

            • Assignee:
              Unassigned
              Reporter:
              Peter Ledbrook
            • Votes:
              36 Vote for this issue
              Watchers:
              18 Start watching this issue

              Dates

              • Created:
                Updated:
                Last Reviewed:

                Development