Changeset 200 for trunk


Ignore:
Timestamp:
Nov 29, 2009, 10:13:48 PM (15 years ago)
Author:
gav
Message:

Fix log4j config that was preventing war building.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/conf/Config.groovy

    r199 r200  
    3737
    3838/**
    39  * Start of log4j configuration.
    40  * Causing this file to reload (e.g. edit/save) may break the appLog destination
    41  * and further logs will be written to files or directories like "[:]"
     39 * Log4j configuration.
     40 * Causing this file to reload (e.g. edit+save) may break the appLog destination
     41 * and further logs will be written to files or directories like "[:]".
    4242 * For more info see http://logging.apache.org/log4j/1.2/manual.html
    4343 * For log levels see http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html
    4444 * Basic log levels are ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < OFF
    4545 */
    46 def logDirectory = '.'
     46// Pickup the Tomcat/Catalina logDirectory else use the current dir.
     47def catalinaBase = System.properties.getProperty('catalina.base')
     48def logDirectory = catalinaBase ? "${catalinaBase}/logs" : '.'
    4749
    4850log4j = {
    4951    appenders {
    5052        // Use if we want to prevent creation of a stacktrace.log file.
    51         // Beware that since we are using assingment above 'log4j =' this may override things you did not want to.
    5253        'null' name:'stacktrace'
    5354
     
    8586    error "grails.app" // Set the default log level for our app code.
    8687    info "grails.app.bootstrap" // Set the log level per type and per type.class
    87     debug "grails.app.service"
    88     debug "grails.app.controller"
    8988    error "grails.app.service.PersonService"
    9089    error "grails.app.service.NavigationService"
    9190    error "grails.app.service.com.zeddware.grails.plugins.filterpane.FilterService"
     91
     92    // Move anything that should behave differently into this section.
     93    switch(environment) {
     94        case 'development':
     95            debug "grails.app.service"
     96            debug "grails.app.controller"
     97            break
     98        case 'test':
     99            debug "grails.app.service"
     100            debug "grails.app.controller"
     101            break
     102        case 'production':
     103            warn "grails.app.service"
     104            warn "grails.app.controller"
     105            break
     106    }
    92107}
    93108
     
    99114    production {
    100115        grails.serverURL = "http://www.changeme.com" // Set serverURL stem for creating absolute links.
    101         log4j {
    102             appenders {
    103                 // Pickup the Tomcat/Catalina logDirectory else use the current dir.
    104                 def catalinaBase = System.properties.getProperty('catalina.base')
    105                 logDirectory = catalinaBase ? "${catalinaBase}/logs" : '.'
    106 
    107                 rollingFile name:"appLog",
    108                                 file:"${logDirectory}/${appName}.log".toString(),
    109                                 maxFileSize:'1MB',
    110                                 maxBackupIndex:0,
    111                                 layout:pattern(conversionPattern: '%d{[EEE, dd-MMM-yyyy @ HH:mm:ss.SSS]} [%t] %-5p %c %x - %m%n')
    112 
    113             }
    114             error "grails.app" // Set the default log level for our app code.
    115             info "grails.app.bootstrap" // Set the log level per type and per type.class
    116             warn "grails.app.service"
    117             warn "grails.app.controller"
    118         }
    119116    }
    120117
Note: See TracChangeset for help on using the changeset viewer.