jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Griffon
  • GRIFFON-444

Implement Grails like Capability to Change Logging Backends

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 0.9.4
  • Fix Version/s: 0.9.5-rc1
  • Component/s: cli, rt
  • Labels:
    None

Description

add the capability to exchange the defauly log4j logging implementation with a different framework (e.g. logback). Ideally the mechanism to do so would be identical to Grails as outlined in this article: http://www.lazygun.net/grails-replacing-log4j-with-logback

See the griffon user mailing list discussion: How does one replace log4j with logback

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Andres Almiray added a comment - 14/Jan/12 9:19 AM

Instructions as explained on that blog post do work for Griffon too.

1. Exclude log4j dependencies from global space, but do not exclude log4j-1.2.16 as it will cause a CNFE at runtime (some classes are required by the logging DSL).

2. configure Logback in the dependency DSL, like this

griffon.project.dependency.resolution = {
    inherits("global") {
        excludes 'slf4j-log4j12', 'log4j-over-slf4j'
    }
    log "warn"
    repositories {
        griffonHome()
        mavenCentral()
    }
    dependencies {
        String logbackVersion = '1.0.0'
        build   "ch.qos.logback:logback-core:$logbackVersion",
                "ch.qos.logback:logback-classic:$logbackVersion"
        runtime "ch.qos.logback:logback-core:$logbackVersion",
                "ch.qos.logback:logback-classic:$logbackVersion"
    }
}

3. Create a suitable Logback configuration in griffon-app/conf/resources/logback.xml

<configuration debug="true" scan="true" scanPeriod="30 seconds">
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <layout>
      <pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern>
    </layout>
  </appender>

  <logger name="griffon" level="INFO"/>
  <logger name="org.codehaus.griffon" level="DEBUG"/>

  <root level="warn">
    <appender-ref ref="STDOUT" />
  </root>
</configuration>

4. Profit!

Show
Andres Almiray added a comment - 14/Jan/12 9:19 AM Instructions as explained on that blog post do work for Griffon too. 1. Exclude log4j dependencies from global space, but do not exclude log4j-1.2.16 as it will cause a CNFE at runtime (some classes are required by the logging DSL). 2. configure Logback in the dependency DSL, like this
griffon.project.dependency.resolution = {
    inherits("global") {
        excludes 'slf4j-log4j12', 'log4j-over-slf4j'
    }
    log "warn"
    repositories {
        griffonHome()
        mavenCentral()
    }
    dependencies {
        String logbackVersion = '1.0.0'
        build   "ch.qos.logback:logback-core:$logbackVersion",
                "ch.qos.logback:logback-classic:$logbackVersion"
        runtime "ch.qos.logback:logback-core:$logbackVersion",
                "ch.qos.logback:logback-classic:$logbackVersion"
    }
}
3. Create a suitable Logback configuration in griffon-app/conf/resources/logback.xml
<configuration debug="true" scan="true" scanPeriod="30 seconds">
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <layout>
      <pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern>
    </layout>
  </appender>

  <logger name="griffon" level="INFO"/>
  <logger name="org.codehaus.griffon" level="DEBUG"/>

  <root level="warn">
    <appender-ref ref="STDOUT" />
  </root>
</configuration>
4. Profit!
Hide
Permalink
Andres Almiray added a comment - 14/Jan/12 9:20 AM

Disabling all Log4j dependencies and enabling a Logback DSL would be different RFEs.

Show
Andres Almiray added a comment - 14/Jan/12 9:20 AM Disabling all Log4j dependencies and enabling a Logback DSL would be different RFEs.

People

  • Assignee:
    Andres Almiray
    Reporter:
    Stephen Nesbitt
Vote (0)
Watch (0)

Dates

  • Created:
    06/Jan/12 1:52 PM
    Updated:
    09/Mar/12 9:29 AM
    Resolved:
    14/Jan/12 9:19 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.