JAVA-30302 Review log statements for projects - Week 52 - 2023 (conti-2) (#15623)

This commit is contained in:
timis1 2024-01-15 23:40:59 +02:00 committed by GitHub
parent 4e46f6626a
commit 9dd807367b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 21 additions and 18 deletions

View File

@ -6,9 +6,9 @@
</appender> </appender>
<logger name="com.baeldung.httpclient.cookies" level="info"/> <logger name="com.baeldung.httpclient.cookies" level="info"/>
<logger name="com.baeldung.httpclient.readresponsebodystring" level="debug"/> <logger name="com.baeldung.httpclient.readresponsebodystring" level="INFO"/>
<logger name="org.apache.http" level="debug"/> <logger name="org.apache.http" level="WARN"/>
<logger name="org.apache.hc.client5.http" level="debug"/> <logger name="org.apache.hc.client5.http" level="WARN"/>
<root level="WARN"> <root level="WARN">
<appender-ref ref="stdout"/> <appender-ref ref="stdout"/>

View File

@ -10,7 +10,7 @@ import feign.gson.GsonEncoder;
import feign.slf4j.Slf4jLogger; import feign.slf4j.Slf4jLogger;
import uk.org.webcompere.lightweightconfig.ConfigLoader; import uk.org.webcompere.lightweightconfig.ConfigLoader;
import static feign.Logger.Level.FULL; import static feign.Logger.Level.BASIC;
public class Services extends AbstractModule { public class Services extends AbstractModule {
@Override @Override
@ -20,14 +20,14 @@ public class Services extends AbstractModule {
ToDoApi toDoApi = Feign.builder() ToDoApi toDoApi = Feign.builder()
.decoder(new GsonDecoder()) .decoder(new GsonDecoder())
.logger(new Slf4jLogger()) .logger(new Slf4jLogger())
.logLevel(FULL) .logLevel(BASIC)
.requestInterceptor(new BasicAuthRequestInterceptor(config.getToDoCredentials().getUsername(), config.getToDoCredentials().getPassword())) .requestInterceptor(new BasicAuthRequestInterceptor(config.getToDoCredentials().getUsername(), config.getToDoCredentials().getPassword()))
.target(ToDoApi.class, config.getToDoEndpoint()); .target(ToDoApi.class, config.getToDoEndpoint());
PostApi postApi = Feign.builder() PostApi postApi = Feign.builder()
.encoder(new GsonEncoder()) .encoder(new GsonEncoder())
.logger(new Slf4jLogger()) .logger(new Slf4jLogger())
.logLevel(FULL) .logLevel(BASIC)
.requestInterceptor(new BasicAuthRequestInterceptor(config.getPostCredentials().getUsername(), config.getPostCredentials().getPassword())) .requestInterceptor(new BasicAuthRequestInterceptor(config.getPostCredentials().getUsername(), config.getPostCredentials().getPassword()))
.target(PostApi.class, config.getPostEndpoint()); .target(PostApi.class, config.getPostEndpoint());

View File

@ -1,7 +1,5 @@
package com.baeldung.closures package com.baeldung.closures
import spock.lang.Specification
class ClosuresUnitTest extends GroovyTestCase { class ClosuresUnitTest extends GroovyTestCase {
Closures closures = new Closures() Closures closures = new Closures()
@ -64,9 +62,9 @@ class ClosuresUnitTest extends GroovyTestCase {
void testClosureInLists() { void testClosureInLists() {
def list = [10, 11, 12, 13, 14, true, false, "BUNTHER"] def list = [10, 11, 12, 13, 14, true, false, "BUNTHER"]
list.each { /*list.each {
println it println it
} }*/
assert [13, 14] == list.findAll{ it instanceof Integer && it >= 13} assert [13, 14] == list.findAll{ it instanceof Integer && it >= 13}
} }

View File

@ -18,7 +18,8 @@ public class Employee {
} }
private static void incrementCount() { private static void incrementCount() {
System.out.println("Count = " + ++count); ++count;
// System.out.println("Count = " + ++count);
} }
public static Integer getCount() { public static Integer getCount() {

View File

@ -24,7 +24,8 @@ public class Employee {
private static void incrementCount() { private static void incrementCount() {
lock.lock(); lock.lock();
try { try {
System.out.println("Count = " + ++count); ++count;
// System.out.println("Count = " + ++count);
} }
finally { finally {
lock.unlock(); lock.unlock();

View File

@ -21,7 +21,8 @@ public class Employee {
private static void incrementCount() { private static void incrementCount() {
synchronized(lock) { synchronized(lock) {
System.out.println("Count = " + ++count); ++count;
// System.out.println("Count = " + ++count);
} }
} }

View File

@ -19,7 +19,8 @@ public class Employee
private static void incrementCount() { private static void incrementCount() {
synchronized(Employee.class) { synchronized(Employee.class) {
System.out.println("Count = " + ++count); ++count;
// System.out.println("Count = " + ++count);
} }
} }

View File

@ -18,7 +18,8 @@ public class Employee {
} }
private static synchronized void incrementCount() { private static synchronized void incrementCount() {
System.out.println("Count = " + ++count); ++count;
// System.out.println("Count = " + ++count);
} }
public static synchronized int getCount() { public static synchronized int getCount() {

View File

@ -29,7 +29,7 @@ public class PortScanner {
openPorts.add(currentPort); openPorts.add(currentPort);
System.out.println(ip + " ,port open: " + currentPort); System.out.println(ip + " ,port open: " + currentPort);
} catch (IOException e) { } catch (IOException e) {
System.err.println(e); // System.err.println(e);
} }
}); });
} }

View File

@ -12,7 +12,7 @@ public class ProcessUtils {
public static String getClassPath() { public static String getClassPath() {
String cp = System.getProperty("java.class.path"); String cp = System.getProperty("java.class.path");
System.out.println("ClassPath is " + cp); // System.out.println("ClassPath is " + cp);
return cp; return cp;
} }

View File

@ -50,7 +50,7 @@ public class ProcessBuilderUnitTest {
public void givenProcessBuilder_whenModifyEnvironment_thenSuccess() throws IOException, InterruptedException { public void givenProcessBuilder_whenModifyEnvironment_thenSuccess() throws IOException, InterruptedException {
ProcessBuilder processBuilder = new ProcessBuilder(); ProcessBuilder processBuilder = new ProcessBuilder();
Map<String, String> environment = processBuilder.environment(); Map<String, String> environment = processBuilder.environment();
environment.forEach((key, value) -> System.out.println(key + value)); // environment.forEach((key, value) -> System.out.println(key + value));
environment.put("GREETING", "Hola Mundo"); environment.put("GREETING", "Hola Mundo");