Added logging support using SLF4J backed by Log4J.
This commit is contained in:
parent
790d2c2a77
commit
966ebbf36a
@ -2,4 +2,4 @@
|
|||||||
#Thu May 27 05:01:16 CDT 2010
|
#Thu May 27 05:01:16 CDT 2010
|
||||||
app.griffon.version=0.3
|
app.griffon.version=0.3
|
||||||
app.name=pit-swing
|
app.name=pit-swing
|
||||||
app.version=2.4.0
|
app.version=2.5.0
|
||||||
|
5
pit-swing/griffon-app/conf/Events.groovy
Normal file
5
pit-swing/griffon-app/conf/Events.groovy
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
|
onNewInstance = { klass, type, instance ->
|
||||||
|
instance.metaClass.logger = LoggerFactory.getLogger(klass.name)
|
||||||
|
}
|
@ -17,49 +17,56 @@ class PITController {
|
|||||||
model.issueListRenderer = new IssueTableCellRenderer()
|
model.issueListRenderer = new IssueTableCellRenderer()
|
||||||
|
|
||||||
File pitHome, pitrcFile, pitswingrcFile
|
File pitHome, pitrcFile, pitswingrcFile
|
||||||
|
boolean logDbg = logger.isDebugEnabled()
|
||||||
Properties config = new Properties()
|
Properties config = new Properties()
|
||||||
|
|
||||||
// look for config directory
|
// look for config directory
|
||||||
pitHome = new File(System.getProperty('user.home'), '.pit')
|
pitHome = new File(System.getProperty('user.home'), '.pit')
|
||||||
println "$pitHome is ${pitHome.exists() ? '' : 'not '} present."
|
if (logDbg) logger.debug("$pitHome is " +
|
||||||
|
(pitHome.exists() ? '' : 'not ') + "present.")
|
||||||
|
|
||||||
// look for general config options
|
// look for general config options
|
||||||
pitrcFile = new File(pitHome, 'pitrc')
|
pitrcFile = new File(pitHome, 'pitrc')
|
||||||
println "$pitrcFile is ${pitrcFile.exists() ? '' : 'not '} present."
|
if(logDbg) logger.debug("$pitrcFile is " +
|
||||||
|
(pitrcFile.exists() ? '' : 'not ') + "present.")
|
||||||
|
|
||||||
// load general config (if present)
|
// load general config (if present)
|
||||||
if (pitrcFile.exists()) {
|
if (pitrcFile.exists()) {
|
||||||
pitrcFile.withInputStream() { config.load(it) }
|
pitrcFile.withInputStream() { config.load(it) }
|
||||||
println "Loaded pitrc"
|
if (logDbg) logger.debug("Loaded pitrc")
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for swing specific config
|
// look for swing specific config
|
||||||
pitswingrcFile = new File(pitHome, 'pitswingrc')
|
pitswingrcFile = new File(pitHome, 'pitswingrc')
|
||||||
println "$pitswingrcFile is " (pitswingrcFile.exists() ?
|
if (logDbg) logger.debug("$pitswingrcFile is " +
|
||||||
'' : 'not ') + "present."
|
(pitswingrcFile.exists() ? '' : 'not ') + "present.")
|
||||||
|
|
||||||
// load swing specific config (if present)
|
// load swing specific config (if present)
|
||||||
if (pitswingrcFile.exists()) {
|
if (pitswingrcFile.exists()) {
|
||||||
pitswingrcFile.withInputStream() { config.load(it) }
|
pitswingrcFile.withInputStream() { config.load(it) }
|
||||||
println "Loaded pitswingrc"
|
if(logDbg) logger.debug("Loaded pitswingrc")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process Configurable Options
|
// Process Configurable Options
|
||||||
// ----------------------------
|
// ----------------------------
|
||||||
|
|
||||||
config.keySet().each { println it }
|
if (logDbg) {
|
||||||
|
logger.debug("Configurable properties:")
|
||||||
|
config.keySet().each { logger.debug(it) }
|
||||||
|
}
|
||||||
|
|
||||||
// add custom category templates
|
// add custom category templates
|
||||||
Category.values().each { category ->
|
Category.values().each { category ->
|
||||||
def expectedKey = "issue." + category.name().toLowerCase() +
|
def expectedKey = "issue." + category.name().toLowerCase() +
|
||||||
".template"
|
".template"
|
||||||
println "Looking for key: $expectedKey"
|
if(logDbg) logger.debug("Looking for key: $expectedKey")
|
||||||
|
|
||||||
config.keySet().each { currentKey ->
|
config.keySet().each { currentKey ->
|
||||||
if (currentKey == expectedKey)
|
if (currentKey == expectedKey)
|
||||||
model.templates[(category)] =
|
model.templates[(category)] =
|
||||||
config.getProperty(expectedKey, "")
|
config.getProperty(expectedKey, "")
|
||||||
println "Template for category $category: '" +
|
if (logDbg) logger.debug("Template for category $category: '" +
|
||||||
model.templates[(category)] + "'"
|
model.templates[(category)] + "'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +78,7 @@ class PITController {
|
|||||||
def initRepos = config.getProperty('initial-repositories', '')
|
def initRepos = config.getProperty('initial-repositories', '')
|
||||||
initRepos = initRepos.split(/[;:,]/)
|
initRepos = initRepos.split(/[;:,]/)
|
||||||
initRepos.each { repoPath -> loadProject(new File(repoPath)) }
|
initRepos.each { repoPath -> loadProject(new File(repoPath)) }
|
||||||
println "Init repos: '$initRepos'"
|
if(logDbg) logger.debug("Init repos: '$initRepos'")
|
||||||
}
|
}
|
||||||
|
|
||||||
// load custom issue CSS
|
// load custom issue CSS
|
||||||
@ -88,7 +95,7 @@ class PITController {
|
|||||||
(cssFile = new File(issueCSS).exists()))
|
(cssFile = new File(issueCSS).exists()))
|
||||||
issueCSS = cssFile.text
|
issueCSS = cssFile.text
|
||||||
|
|
||||||
println "CS for issue display: $issueCSS"
|
if (logDbg) logger.debug("CS for issue display: $issueCSS")
|
||||||
model.issueCSS = issueCSS
|
model.issueCSS = issueCSS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,8 @@ class ProjectPanelController {
|
|||||||
result.append(line)
|
result.append(line)
|
||||||
|
|
||||||
// add in the CSS information to the head
|
// add in the CSS information to the head
|
||||||
if (line =~/<head>/) result.append(model.issueCSS)
|
if (line =~/<head>/) result.append('<style type="text/css">' +
|
||||||
|
model.issueCSS + '</style>')
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.toString()
|
return result.toString()
|
||||||
|
@ -22,13 +22,8 @@ import griffon.util.GriffonPlatformHelper
|
|||||||
import griffon.util.GriffonApplicationHelper
|
import griffon.util.GriffonApplicationHelper
|
||||||
|
|
||||||
GriffonPlatformHelper.tweakForNativePlatform(app)
|
GriffonPlatformHelper.tweakForNativePlatform(app)
|
||||||
SwingBuilder.lookAndFeel('mac', 'org.pushingpixels.substance.api.skin.SubstanceCremeCoffeeLookAndFeel', 'nimbus', ['metal', [boldFonts: false]])
|
SwingBuilder.lookAndFeel('org.pushingpixels.substance.api.skin.SubstanceCremeCoffeeLookAndFeel', 'nimbus', ['metal', [boldFonts: false]])
|
||||||
|
|
||||||
// make config directory
|
// make config directory
|
||||||
def confDir = new File(System.getProperty('user.home'), '.pit')
|
def confDir = new File(System.getProperty('user.home'), '.pit')
|
||||||
if (!confDir.exists()) confDir.mkdirs()
|
if (!confDir.exists()) confDir.mkdirs()
|
||||||
// find or create configuration file
|
|
||||||
def swingConf = new File(confDir, 'pit-swing.groovy')
|
|
||||||
if (!swingConf.exists()) swingConf.createNewFile()
|
|
||||||
// run config
|
|
||||||
GriffonApplicationHelper.runScriptInsideEDT(swingConf.canonicalPath, app)
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
<style type="text/css">
|
|
||||||
body {
|
body {
|
||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
@ -21,4 +20,3 @@ h4 {
|
|||||||
table,th,td{
|
table,th,td{
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
9
pit-swing/griffon-app/resources/log4j.properties
Normal file
9
pit-swing/griffon-app/resources/log4j.properties
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
log4j.rootLogger=DEBUG,stdout,fileout
|
||||||
|
|
||||||
|
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||||
|
log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout
|
||||||
|
|
||||||
|
log4j.appender.fileout=org.apache.log4j.FileAppender
|
||||||
|
log4j.appender.fileout.file=pit-swing.log
|
||||||
|
log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.fileout.layout.ConversionPattern=%-5p %C %d{DATE}: %m%n
|
BIN
pit-swing/lib/slf4j-api-1.6.0.jar
Normal file
BIN
pit-swing/lib/slf4j-api-1.6.0.jar
Normal file
Binary file not shown.
BIN
pit-swing/lib/slf4j-log4j12-1.6.0.jar
Normal file
BIN
pit-swing/lib/slf4j-log4j12-1.6.0.jar
Normal file
Binary file not shown.
@ -1 +1 @@
|
|||||||
application.version=2.4.0
|
application.version=2.5.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user