Colored logs, YAYYYYY

This commit is contained in:
2024-11-24 01:49:02 +02:00
parent 5539304ff7
commit 11af7ba6ea
10 changed files with 35 additions and 17 deletions

View File

@@ -27,12 +27,12 @@ public class BrokerConnector {
CountDownLatch latch = new CountDownLatch(1);
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
logger.info("Shutdown signal received.");
logger.info("Shutdown signal received. - OK");
latch.countDown();
}));
boolean success = connectToRabbitMQ(latch);
logger.info("Success: {}", success);
logger.info("Success: {} - OK", success);
}
private static boolean connectToRabbitMQ(CountDownLatch latch) {
@@ -46,7 +46,7 @@ public class BrokerConnector {
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor()) {
channel.queueDeclare(QUEUE_NAME, false, false, false, null);
logger.info("Connected to RabbitMQ and queue declared.");
logger.info("Connected to RabbitMQ and queue declared. - OK");
scheduler.scheduleAtFixedRate(() -> {
try {
@@ -63,7 +63,7 @@ public class BrokerConnector {
return scheduler.awaitTermination(5, TimeUnit.SECONDS);
} catch (Exception e) {
logger.info("Awaiting broker connection: {}", e.getMessage());
logger.error("Awaiting broker connection: {}", e.getMessage());
try {
Thread.sleep(5000);
connectToRabbitMQ(latch);

View File

@@ -3,7 +3,9 @@
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss} [%t] %-5level: %msg%n</Pattern>
<Pattern>
%highlight{%d{yyyy-MM-dd HH:mm:ss} %-5level [%t]: %msg}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=blue}%n
</Pattern>
</PatternLayout>
</Console>
</Appenders>