Switch to using slf4j/logback for logging.

We still compile modules against commons-logging but all runtime logging and samples will use logback
This commit is contained in:
Luke Taylor 2010-07-12 12:30:21 +01:00
parent ed447f63f6
commit 69a10c48ae
9 changed files with 74 additions and 45 deletions

View File

@ -1,9 +0,0 @@
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%p %c{1} - %m%n
log4j.logger.org.springframework.security=DEBUG
log4j.logger.org.apache.directory=ERROR

View File

@ -0,0 +1,14 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.apache.directory" level="WARN"/>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -9,13 +9,17 @@ apacheDsVersion = '1.5.5'
jstlVersion = '1.1.2'
jettyVersion = '6.1.22'
hsqlVersion = '1.8.0.10'
slf4jVersion = '1.6.1'
logbackVersion = '0.9.24'
configurations {
provided
compile.extendsFrom provided
compile.transitive = false
}
dependencies {
// We only compile against commons logging. It is excluded from all other configurations
compile 'commons-logging:commons-logging:1.1.1'
compile ("org.springframework:spring-core:$springVersion") {
@ -29,8 +33,17 @@ dependencies {
'org.hamcrest:hamcrest-core:1.1',
'org.hamcrest:hamcrest-library:1.1',
"org.springframework:spring-test:$springVersion"
// Use slf4j/logback for logging
testRuntime "org.slf4j:slf4j-api:$slf4jVersion",
"org.slf4j:jcl-over-slf4j:$slf4jVersion",
"ch.qos.logback:logback-core:$logbackVersion",
"ch.qos.logback:logback-classic:$logbackVersion"
}
// Get rid of commons logging
[configurations.runtime, configurations.default]*.exclude(module: 'commons-logging')
test {
onlyIf {
!project.hasProperty('skipTests')

View File

@ -1,12 +0,0 @@
# Logging
#
log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%p,%c{1}] %m%n
log4j.logger.org.springframework.security=WARN
log4j.logger.org.springframework.ldap=WARN
log4j.logger.org.apache.directory=ERROR

View File

@ -0,0 +1,14 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.apache.directory" level="WARN"/>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -2,24 +2,32 @@
test.exclude('**/OpenLDAPIntegrationTestSuite.class')
apacheds_libs = [
"org.apache.directory.server:apacheds-core:$apacheDsVersion",
"org.apache.directory.server:apacheds-core-entry:$apacheDsVersion",
"org.apache.directory.server:apacheds-protocol-shared:$apacheDsVersion",
"org.apache.directory.server:apacheds-protocol-ldap:$apacheDsVersion",
"org.apache.directory.server:apacheds-server-jndi:$apacheDsVersion",
'org.apache.directory.shared:shared-ldap:0.9.15'
]
dependencies {
compile project(':spring-security-core'),
"org.springframework:spring-beans:$springVersion",
"org.springframework:spring-context:$springVersion",
"org.springframework:spring-tx:$springVersion",
"org.apache.directory.server:apacheds-core:$apacheDsVersion",
"org.apache.directory.server:apacheds-core-entry:$apacheDsVersion",
"org.apache.directory.server:apacheds-protocol-shared:$apacheDsVersion",
"org.apache.directory.server:apacheds-protocol-ldap:$apacheDsVersion",
"org.apache.directory.server:apacheds-server-jndi:$apacheDsVersion",
'org.apache.directory.shared:shared-ldap:0.9.15',
'ldapsdk:ldapsdk:4.1'
apacheds_libs.collect {
compile (it) {
exclude group: 'org.slf4j'
}
}
compile ("org.springframework.ldap:spring-ldap-core:$springLdapVersion") {
exclude(group: 'commons-logging', module: 'commons-logging')
exclude(group: 'org.springframework', module: 'spring-core')
exclude(group: 'org.springframework', module: 'spring-tx')
exclude(group: 'org.springframework', module: 'spring-beans')
}
}
runtime 'org.slf4j:slf4j-log4j12:1.4.3'
}

View File

@ -1,13 +0,0 @@
# Logging
#
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%p %c{1} - %m%n
log4j.logger.org.springframework.security=DEBUG
log4j.logger.org.springframework.ldap=DEBUG
log4j.logger.org.apache.directory=INFO

View File

@ -0,0 +1,14 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.apache.directory" level="WARN"/>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -10,11 +10,11 @@ dependencies {
"org.springframework:spring-expression:$springVersion",
"org.springframework:spring-jdbc:$springVersion",
"org.springframework:spring-tx:$springVersion",
"org.springframework:spring-web:$springVersion",
"org.springframework:spring-test:$springVersion"
"org.springframework:spring-web:$springVersion"
provided 'javax.servlet:servlet-api:2.5'
testCompile 'commons-codec:commons-codec:1.3'
testCompile 'commons-codec:commons-codec:1.3',
"org.springframework:spring-test:$springVersion"
testRuntime "hsqldb:hsqldb:$hsqlVersion"
}