logging specific package's messages to one file in grails and log4j
trying to get all of the log statements from class GetThatDataFilters to go to the rolling file 'dailydata' and everything else to the console and the daily rolling file.
dont know if I am missing something from the grails documentation http://www.grails.org/doc/latest/guide/3.%20Configuration.html#3.1.2%20Logging
// ============================================================================
// log4j configuration
//============================================================================
log4j = {
// Example of changing the log pattern for the default console
// appender:
//
app开发者_StackOverflow社区enders {
console name: 'stdout', layout: pattern(conversionPattern: '%d %-5p %c{1} - %m%n')
//daily rolling log
appender new DailyRollingFileAppender(name: 'daily', datePattern: "'.'yyyy-MM-dd",
layout: pattern(conversionPattern: '%d %-5p %c{1} - %m%n'),
file: 'logs/daily.log')
//daily search rolling log
appender new DailyRollingFileAppender(name: 'dailydata', datePattern: "'.'yyyy-MM-dd",
layout: pattern(conversionPattern: '%d %-5p %c{1} - %m%n'),
file: 'logs/daily-data.log')
}
error dailysearch: "GetThatDataFilters"
root {
error 'stdout', 'daily'
additivity = true
}
debug 'grails.app'
}
Try the following:
error dailydata: "GetThatDataFilters", additivity: false
root {
error 'stdout', 'daily'
additivity = true
}
debug 'grails.app'
精彩评论