Skip to content

Commit 0345f21

Browse files
committed
Moving to SLF4J
1 parent 69dec45 commit 0345f21

File tree

5 files changed

+22
-35
lines changed

5 files changed

+22
-35
lines changed

build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ subprojects {
139139

140140
dependencies {
141141
compile 'junit:junit:4.12'
142+
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.+'
143+
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.+'
144+
// You can also use the JDK's built-in logging as the back end:
145+
// compile group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.7.5'
142146
}
143147

144148
sourceSets {

verifying/InfoLogging.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

verifying/SLF4JLogging.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// verifying/SLF4JLogging.java
2+
// (c)2016 MindView LLC: see Copyright.txt
3+
// We make no guarantees that this code is fit for any purpose.
4+
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
5+
import org.slf4j.*;
6+
7+
public class SLF4JLogging {
8+
private static final Logger logger =
9+
LoggerFactory.getLogger(SLF4JLogging.class);
10+
public static void main(String[] args) {
11+
logger.info("hello logging");
12+
}
13+
}
14+
/* Output:
15+
17:58:42.798 [main] INFO SLF4JLogging - hello logging
16+
*/

verifying/SimpleJUnit.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import org.junit.*;
88
import static org.junit.Assert.*;
99

10-
// So we can see the list objects being created,
11-
// and keep track of when they are cleaned up:
10+
// Keeps track of list objects as they are
11+
// created and cleaned up:
1212
class CountedList extends ArrayList<String> {
1313
private static int counter = 0;
1414
private int id = counter++;

verifying/log4j2.xml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)