[JAVA-9019] Move sysout lines to info logging
This commit is contained in:
parent
30c54f2623
commit
a8ce62042f
|
@ -1,17 +1,16 @@
|
||||||
package com.baeldung.collections.iterators;
|
package com.baeldung.collections.iterators;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
|
||||||
* Source code https://github.com/eugenp/tutorials
|
|
||||||
*
|
|
||||||
* @author Santosh Thakur
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class Iterators {
|
public class Iterators {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(Iterators.class);
|
||||||
|
|
||||||
public static int failFast1() {
|
public static int failFast1() {
|
||||||
ArrayList<Integer> numbers = new ArrayList<>();
|
ArrayList<Integer> numbers = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -44,7 +43,7 @@ public class Iterators {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("using iterator's remove method = " + numbers);
|
LOG.debug("using iterator's remove method = {}", numbers);
|
||||||
|
|
||||||
iterator = numbers.iterator();
|
iterator = numbers.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.baeldung.collections.bitset;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.openjdk.jol.info.ClassLayout;
|
import org.openjdk.jol.info.ClassLayout;
|
||||||
import org.openjdk.jol.info.GraphLayout;
|
import org.openjdk.jol.info.GraphLayout;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
|
|
||||||
|
@ -10,18 +12,20 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
public class BitSetUnitTest {
|
public class BitSetUnitTest {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(BitSetUnitTest.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenBoolArray_whenMemoryLayout_thenConsumeMoreThanOneBit() {
|
public void givenBoolArray_whenMemoryLayout_thenConsumeMoreThanOneBit() {
|
||||||
boolean[] bits = new boolean[1024 * 1024];
|
boolean[] bits = new boolean[1024 * 1024];
|
||||||
|
|
||||||
System.out.println(ClassLayout.parseInstance(bits).toPrintable());
|
LOG.debug(ClassLayout.parseInstance(bits).toPrintable());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenBitSet_whenMemoryLayout_thenConsumeOneBitPerFlag() {
|
public void givenBitSet_whenMemoryLayout_thenConsumeOneBitPerFlag() {
|
||||||
BitSet bitSet = new BitSet(1024 * 1024);
|
BitSet bitSet = new BitSet(1024 * 1024);
|
||||||
|
|
||||||
System.out.println(GraphLayout.parseInstance(bitSet).toPrintable());
|
LOG.debug(GraphLayout.parseInstance(bitSet).toPrintable());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -157,7 +161,7 @@ public class BitSetUnitTest {
|
||||||
BitSet bitSet = new BitSet();
|
BitSet bitSet = new BitSet();
|
||||||
bitSet.set(15, 25);
|
bitSet.set(15, 25);
|
||||||
|
|
||||||
bitSet.stream().forEach(System.out::println);
|
bitSet.stream().forEach(bit -> LOG.debug(String.valueOf(bit)));
|
||||||
assertThat(bitSet.stream().count()).isEqualTo(10);
|
assertThat(bitSet.stream().count()).isEqualTo(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
Loading…
Reference in New Issue