deleting / moving project dir
This commit is contained in:
@@ -27,12 +27,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
|
||||
+1
-1
@@ -10,6 +10,6 @@ public class DemoService {
|
||||
private final Logger LOG = LoggerFactory.getLogger(DemoService.class);
|
||||
|
||||
public void log() {
|
||||
LOG.info("DemoService.log invoked!!!");
|
||||
LOG.info("DemoService.log invoked");
|
||||
}
|
||||
}
|
||||
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
package com.baeldung.extensions;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class SpringBootLogbackExtensionsApplication {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SpringBootLogbackExtensionsApplication.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SpringBootLogbackExtensionsApplication.class, args);
|
||||
|
||||
logger.debug("Debug log message");
|
||||
logger.info("Info log message");
|
||||
logger.error("Error log message");
|
||||
logger.warn("Warn log message");
|
||||
logger.trace("Trace log message");
|
||||
}
|
||||
}
|
||||
@@ -2,21 +2,6 @@
|
||||
<configuration>
|
||||
|
||||
<springProperty name="name" source="spring.application.name"/>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>
|
||||
{
|
||||
"level":"%level",
|
||||
"class":"%logger{36}",
|
||||
"thread":"%thread",
|
||||
"message": "%message",
|
||||
"requestId": "%X{X-Request-ID}"
|
||||
}
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
|
||||
<http>
|
||||
<url>http://localhost:3100/loki/api/v1/push</url>
|
||||
@@ -41,7 +26,6 @@
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="LOKI"/>
|
||||
</root>
|
||||
|
||||
|
||||
+4
-3
@@ -37,17 +37,18 @@ public class DemoServiceLiveTest {
|
||||
service.log();
|
||||
Thread.sleep(2000);
|
||||
String baseUrl = "http://localhost:3100/loki/api/v1/query_range";
|
||||
|
||||
// Set up query parameters
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
String query = "{level=\"INFO\"} |= `DemoService.log invoked!!!`";
|
||||
String query = "{level=\"INFO\"} |= `DemoService.log invoked`";
|
||||
|
||||
// Get current time in UTC
|
||||
LocalDateTime currentDateTime = LocalDateTime.now(ZoneOffset.UTC);
|
||||
String current_time_est = currentDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'"));
|
||||
|
||||
LocalDateTime tenMinsAgo = currentDateTime.minusMinutes(10);
|
||||
String start_time_est = tenMinsAgo.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'"));
|
||||
System.out.println(start_time_est);
|
||||
|
||||
URI uri = UriComponentsBuilder.fromUriString(baseUrl)
|
||||
.queryParam("query", query)
|
||||
@@ -80,7 +81,7 @@ public class DemoServiceLiveTest {
|
||||
System.out.println("Error: " + response.getStatusCodeValue());
|
||||
}
|
||||
|
||||
String expected = "DemoService.log invoked!!!";
|
||||
String expected = "DemoService.log invoked";
|
||||
assertTrue(messages.stream().anyMatch(e -> e.contains(expected)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user