-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathlogging.gradle
More file actions
56 lines (49 loc) · 1.68 KB
/
logging.gradle
File metadata and controls
56 lines (49 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import org.gradle.api.artifacts.DependencyResolveDetails
/**
* Adds slf4j and logback to the platform
*/
def slf4jAndLogback(String slf4jVersion = '1.7.5', String logbackVersion = '1.0.13') {
def log4jToSlf4jjVersion = '2.19.0'
repositories {
mavenCentral()
}
configurations {
bndplatform {
// resolution configuration for logging bridges (... over slf4j)
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.name == 'commons-logging') {
// prefer 'jcl-over-slf4j' over 'commons-logging'
details.useTarget "org.slf4j:jcl-over-slf4j:${slf4jVersion}"
}
}
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.name == 'log4j' && details.requested.group == 'log4j') {
// prefer 'log4j-over-slf4j' over 'log4j'
details.useTarget "org.slf4j:log4j-over-slf4j:${slf4jVersion}"
}
}
// exclude SLF4J over LOG4J - logback is used
exclude group: "org.slf4j", module: "slf4j-log4j12"
}
}
platform {
feature id: 'platform.shared.slf4jlogback',
name: 'SLF4J and Logback',
version: slf4jVersion, {
// slf4j
bundle "org.slf4j:slf4j-api:${slf4jVersion}"
bundle "org.slf4j:slf4j-ext:${slf4jVersion}"
bundle "org.apache.logging.log4j:log4j-to-slf4j:${log4jToSlf4jjVersion}"
// jul adapter
bundle "org.slf4j:jul-to-slf4j:${slf4jVersion}"
// logback
bundle "ch.qos.logback:logback-classic:${logbackVersion}"
bundle "ch.qos.logback:logback-core:${logbackVersion}", {
bnd {
// suppress Require-Capability: osgi.ee;filter:="(osgi.ee=UNKNOWN)" generated by bnd
instruction '-removeheaders', 'Require-Capability'
}
}
}
}
}