Fix CVE-2021-44228 (#1231)

* Fix CVE-2021-44228

* Get rid of log4j

* Fix build

* Migration logging properties

* Get rid of json logs. Leave commented for local debugging purposes
This commit is contained in:
Roman Zabaluev 2021-12-22 15:53:46 +03:00 committed by GitHub
parent 6351361c38
commit b2586c41a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 128 additions and 128 deletions

View file

@ -163,8 +163,8 @@ For example, if you want to use an environment variable to set the `name` parame
|Name |Description
|-----------------------|-------------------------------
|`SERVER_SERVLET_CONTEXT_PATH` | URI basePath
|`LOGGING_LEVEL_ROOT` | Setting log level (trace, debug, info, warn, error, fatal, off). Default: debug
|`LOGGING_LEVEL_COM_PROVECTUS` |Setting log level (trace, debug, info, warn, error, fatal, off). Default: debug
|`LOGGING_LEVEL_ROOT` | Setting log level (trace, debug, info, warn, error). Default: info
|`LOGGING_LEVEL_COM_PROVECTUS` |Setting log level (trace, debug, info, warn, error). Default: debug
|`SERVER_PORT` |Port for the embedded server. Default: `8080`
|`KAFKA_ADMIN-CLIENT-TIMEOUT` | Kafka API timeout in ms. Default: `30000`
|`KAFKA_CLUSTERS_0_NAME` | Cluster name

View file

@ -26,12 +26,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -64,6 +58,12 @@
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${zookeper.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
@ -110,8 +110,9 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor.addons</groupId>
<artifactId>reactor-extra</artifactId>

View file

@ -7,7 +7,7 @@ import com.provectus.kafka.ui.model.KsqlCommandResponseDTO;
import com.provectus.kafka.ui.strategy.ksql.statement.BaseStrategy;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
@ -18,7 +18,7 @@ import reactor.core.publisher.Mono;
@Service
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class KsqlClient {
private final WebClient webClient;
private final ObjectMapper mapper;

View file

@ -9,7 +9,7 @@ import com.provectus.kafka.ui.exception.ValidationException;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@ -22,7 +22,7 @@ import reactor.core.publisher.Mono;
import reactor.util.retry.Retry;
import reactor.util.retry.RetryBackoffSpec;
@Log4j2
@Slf4j
public class RetryingKafkaConnectClient extends KafkaConnectClientApi {
private static final int MAX_RETRIES = 5;
private static final Duration RETRIES_DELAY = Duration.ofMillis(200);

View file

@ -2,7 +2,7 @@ package com.provectus.kafka.ui.controller;
import java.nio.charset.Charset;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.web.server.csrf.CsrfToken;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
@ -12,7 +12,7 @@ import reactor.core.publisher.Mono;
@RestController
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class AuthController {
@GetMapping(value = "/auth", produces = { "text/html" })

View file

@ -10,7 +10,7 @@ import com.provectus.kafka.ui.model.BrokersLogdirsDTO;
import com.provectus.kafka.ui.service.BrokerService;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ServerWebExchange;
@ -19,7 +19,7 @@ import reactor.core.publisher.Mono;
@RestController
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class BrokersController extends AbstractController implements BrokersApi {
private final BrokerService brokerService;

View file

@ -6,7 +6,7 @@ import com.provectus.kafka.ui.model.ClusterMetricsDTO;
import com.provectus.kafka.ui.model.ClusterStatsDTO;
import com.provectus.kafka.ui.service.ClusterService;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ServerWebExchange;
@ -15,7 +15,7 @@ import reactor.core.publisher.Mono;
@RestController
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class ClustersController extends AbstractController implements ClustersApi {
private final ClusterService clusterService;

View file

@ -13,7 +13,7 @@ import com.provectus.kafka.ui.service.OffsetsResetService;
import java.util.Map;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RestController;
@ -23,7 +23,7 @@ import reactor.core.publisher.Mono;
@RestController
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class ConsumerGroupsController extends AbstractController implements ConsumerGroupsApi {
private final ConsumerGroupService consumerGroupService;

View file

@ -13,7 +13,7 @@ import com.provectus.kafka.ui.service.KafkaConnectService;
import java.util.Map;
import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ServerWebExchange;
@ -22,7 +22,7 @@ import reactor.core.publisher.Mono;
@RestController
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class KafkaConnectController extends AbstractController implements KafkaConnectApi {
private final KafkaConnectService kafkaConnectService;

View file

@ -11,7 +11,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ServerWebExchange;
@ -21,7 +21,7 @@ import reactor.core.publisher.Mono;
@RestController
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class KsqlController extends AbstractController implements KsqlApi {
private final KsqlService ksqlService;

View file

@ -15,7 +15,7 @@ import java.util.Optional;
import java.util.function.Function;
import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.kafka.common.TopicPartition;
import org.springframework.http.ResponseEntity;
@ -26,7 +26,7 @@ import reactor.core.publisher.Mono;
@RestController
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class MessagesController extends AbstractController implements MessagesApi {
private final MessagesService messagesService;
private final TopicsService topicsService;

View file

@ -10,7 +10,7 @@ import com.provectus.kafka.ui.model.SchemaSubjectDTO;
import com.provectus.kafka.ui.service.SchemaRegistryService;
import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ServerWebExchange;
@ -19,7 +19,7 @@ import reactor.core.publisher.Mono;
@RestController
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class SchemasController extends AbstractController implements SchemasApi {
private final SchemaRegistryService schemaRegistryService;

View file

@ -5,7 +5,7 @@ import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.core.io.Resource;
@ -17,7 +17,7 @@ import reactor.core.publisher.Mono;
@RestController
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class StaticController {
@Value("classpath:static/index.html")

View file

@ -16,7 +16,7 @@ import com.provectus.kafka.ui.service.TopicsService;
import java.util.Optional;
import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
@ -26,7 +26,7 @@ import reactor.core.publisher.Mono;
@RestController
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class TopicsController extends AbstractController implements TopicsApi {
private final TopicsService topicsService;

View file

@ -11,7 +11,7 @@ import java.util.SortedMap;
import java.util.TreeMap;
import java.util.function.Function;
import java.util.stream.Collectors;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
@ -20,7 +20,7 @@ import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.utils.Bytes;
import reactor.core.publisher.FluxSink;
@Log4j2
@Slf4j
public class BackwardRecordEmitter
extends AbstractEmitter
implements java.util.function.Consumer<FluxSink<TopicMessageEventDTO>> {

View file

@ -6,14 +6,14 @@ import com.provectus.kafka.ui.util.OffsetsSeek;
import java.time.Duration;
import java.time.Instant;
import java.util.function.Supplier;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.common.utils.Bytes;
import reactor.core.publisher.FluxSink;
@Log4j2
@Slf4j
public class ForwardRecordEmitter
extends AbstractEmitter
implements java.util.function.Consumer<FluxSink<TopicMessageEventDTO>> {

View file

@ -1,7 +1,7 @@
package com.provectus.kafka.ui.exception;
import java.util.HashSet;
import org.apache.logging.log4j.LogManager;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
@ -31,7 +31,7 @@ public enum ErrorCode {
var codes = new HashSet<Integer>();
for (ErrorCode value : ErrorCode.values()) {
if (!codes.add(value.code())) {
LogManager.getLogger()
LoggerFactory.getLogger(ErrorCode.class)
.warn("Multiple {} values refer to code {}", ErrorCode.class, value.code);
}
}

View file

@ -8,10 +8,10 @@ import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Log4j2
@Slf4j
@Component
@RequiredArgsConstructor
public class DeserializationService {

View file

@ -37,12 +37,12 @@ import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Nullable;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.utils.Bytes;
@Log4j2
@Slf4j
public class SchemaRegistryAwareRecordSerDe implements RecordSerDe {
private static final int CLIENT_IDENTITY_MAP_CAPACITY = 100;

View file

@ -7,7 +7,7 @@ import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.springframework.beans.factory.annotation.Value;
@ -16,7 +16,7 @@ import reactor.core.publisher.Mono;
@Service
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class AdminClientServiceImpl implements AdminClientService, Closeable {
private final Map<String, ReactiveAdminClient> adminClientCache = new ConcurrentHashMap<>();
@Setter // used in tests

View file

@ -19,7 +19,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.admin.ConfigEntry;
import org.apache.kafka.common.Node;
import org.apache.kafka.common.TopicPartitionReplica;
@ -34,7 +34,7 @@ import reactor.core.publisher.Mono;
@Service
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class BrokerService {
private final MetricsCache metricsCache;
@ -109,7 +109,7 @@ public class BrokerService {
e -> Mono.error(new TopicOrPartitionNotFoundException()))
.onErrorResume(LogDirNotFoundException.class,
e -> Mono.error(new LogDirNotFoundApiException()))
.doOnError(log::error);
.doOnError(e -> log.error("Unexpected error", e));
}
public Mono<Void> updateBrokerConfigByName(KafkaCluster cluster,
@ -120,7 +120,7 @@ public class BrokerService {
.flatMap(ac -> ac.updateBrokerConfigByName(broker, name, value))
.onErrorResume(InvalidRequestException.class,
e -> Mono.error(new InvalidRequestApiException(e.getMessage())))
.doOnError(log::error);
.doOnError(e -> log.error("Unexpected error", e));
}
private Mono<Map<Integer, Map<String, DescribeLogDirsResponse.LogDirInfo>>> getClusterLogDirs(

View file

@ -9,13 +9,13 @@ import com.provectus.kafka.ui.model.KafkaCluster;
import java.util.List;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;
@Service
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class ClusterService {
private final MetricsCache metricsCache;

View file

@ -1,7 +1,7 @@
package com.provectus.kafka.ui.service;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Flux;
@ -9,7 +9,7 @@ import reactor.core.scheduler.Schedulers;
@Component
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class ClustersMetricsScheduler {
private final ClustersStorage clustersStorage;

View file

@ -9,7 +9,7 @@ import java.util.Optional;
import java.util.function.Predicate;
import javax.annotation.Nullable;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.Node;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;
@ -17,7 +17,7 @@ import reactor.core.publisher.Mono;
@Service
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class FeatureService {
private static final String DELETE_TOPIC_ENABLED_SERVER_PROPERTY = "delete.topic.enable";

View file

@ -32,7 +32,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClientResponseException;
@ -42,7 +42,7 @@ import reactor.util.function.Tuple2;
import reactor.util.function.Tuples;
@Service
@Log4j2
@Slf4j
@RequiredArgsConstructor
public class KafkaConnectService {
private final ClusterMapper clusterMapper;
@ -146,7 +146,7 @@ public class KafkaConnectService {
return getConnectAddress(cluster, connectName)
.flatMapMany(connect ->
KafkaConnectClients.withBaseUrl(connect).getConnectors(null)
.doOnError(log::error)
.doOnError(e -> log.error("Unexpected error upon getting connectors", e))
);
}

View file

@ -23,7 +23,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.admin.OffsetSpec;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
@ -43,7 +43,7 @@ import reactor.core.scheduler.Schedulers;
@Service
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class MessagesService {
private static final int MAX_LOAD_RECORD_LIMIT = 100;

View file

@ -8,7 +8,7 @@ import com.provectus.kafka.ui.util.JmxClusterUtil;
import java.util.List;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.admin.ConfigEntry;
import org.apache.kafka.clients.admin.TopicDescription;
import org.springframework.stereotype.Service;
@ -16,7 +16,7 @@ import reactor.core.publisher.Mono;
@Service
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class MetricsService {
private final ZookeeperService zookeeperService;

View file

@ -16,7 +16,7 @@ import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.admin.OffsetSpec;
import org.apache.kafka.common.TopicPartition;
import org.springframework.stereotype.Component;
@ -27,7 +27,7 @@ import reactor.core.publisher.Mono;
* to works like "kafka-consumer-groups --reset-offsets" console command
* (see kafka.admin.ConsumerGroupCommand)
*/
@Log4j2
@Slf4j
@Component
@RequiredArgsConstructor
public class OffsetsResetService {

View file

@ -23,7 +23,7 @@ import java.util.stream.Stream;
import javax.annotation.Nullable;
import lombok.RequiredArgsConstructor;
import lombok.Value;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.AlterConfigOp;
import org.apache.kafka.clients.admin.Config;
@ -55,7 +55,7 @@ import reactor.util.function.Tuple2;
import reactor.util.function.Tuples;
@Log4j2
@Slf4j
@RequiredArgsConstructor
public class ReactiveAdminClient implements Closeable {

View file

@ -25,7 +25,7 @@ import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@ -39,7 +39,7 @@ import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@Service
@Log4j2
@Slf4j
@RequiredArgsConstructor
public class SchemaRegistryService {
public static final String NO_SUCH_SCHEMA_VERSION = "No such schema %s with version %s";
@ -68,7 +68,7 @@ public class SchemaRegistryService {
URL_SUBJECTS)
.retrieve()
.bodyToMono(String[].class)
.doOnError(log::error);
.doOnError(e -> log.error("Unexpected error", e));
}
public Flux<SchemaSubjectDTO> getAllVersionsBySubject(KafkaCluster cluster, String subject) {

View file

@ -9,7 +9,7 @@ import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Nullable;
import lombok.RequiredArgsConstructor;
import lombok.Value;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooKeeper;
import org.springframework.stereotype.Service;
@ -19,7 +19,7 @@ import reactor.core.scheduler.Schedulers;
@Service
@RequiredArgsConstructor
@Log4j2
@Slf4j
public class ZookeeperService {
private final Map<String, ZooKeeper> cachedZkClient = new ConcurrentHashMap<>();

View file

@ -21,7 +21,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.admin.ConsumerGroupDescription;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
@ -31,7 +31,7 @@ import org.apache.kafka.common.record.TimestampType;
import org.apache.kafka.common.utils.Bytes;
@Log4j2
@Slf4j
public class ClusterUtil {
private static final ZoneId UTC_ZONE_ID = ZoneId.of("UTC");

View file

@ -28,7 +28,7 @@ import lombok.Builder;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.Value;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.pool2.KeyedObjectPool;
import org.apache.kafka.common.Node;
import org.jetbrains.annotations.Nullable;
@ -39,7 +39,7 @@ import reactor.util.function.Tuple2;
import reactor.util.function.Tuples;
@Component
@Log4j2
@Slf4j
@RequiredArgsConstructor
public class JmxClusterUtil {

View file

@ -8,13 +8,13 @@ import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.rmi.ssl.SslRMIClientSocketFactory;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.pool2.BaseKeyedPooledObjectFactory;
import org.apache.commons.pool2.PooledObject;
import org.apache.commons.pool2.impl.DefaultPooledObject;
@Log4j2
@Slf4j
public class JmxPoolFactory extends BaseKeyedPooledObjectFactory<JmxConnectionInfo, JMXConnector> {
@Override

View file

@ -1,9 +1,9 @@
package com.provectus.kafka.ui.util;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.math.NumberUtils;
@Log4j2
@Slf4j
public class NumberUtil {
private NumberUtil() {

View file

@ -6,7 +6,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.common.TopicPartition;
@ -14,7 +14,7 @@ import org.apache.kafka.common.utils.Bytes;
import reactor.util.function.Tuple2;
import reactor.util.function.Tuples;
@Log4j2
@Slf4j
public abstract class OffsetsSeek {
protected final String topic;
protected final ConsumerPosition consumerPosition;

View file

@ -8,14 +8,14 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.utils.Bytes;
import reactor.util.function.Tuple2;
import reactor.util.function.Tuples;
@Log4j2
@Slf4j
public class OffsetsSeekBackward extends OffsetsSeek {
private final int maxMessages;

View file

@ -6,12 +6,12 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.utils.Bytes;
@Log4j2
@Slf4j
public class OffsetsSeekForward extends OffsetsSeek {
public OffsetsSeekForward(String topic, ConsumerPosition consumerPosition) {

View file

@ -10,3 +10,11 @@ management:
web:
exposure:
include: "info,health"
logging:
level:
root: INFO
com.provectus: DEBUG
#org.springframework.http.codec.json.Jackson2JsonEncoder: DEBUG
#org.springframework.http.codec.json.Jackson2JsonDecoder: DEBUG
reactor.netty.http.server.AccessLog: INFO

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="ERROR">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Logger name="com.provectus" level="debug" additivity="false">
<AppenderRef ref="Console"/>
</Logger>
<Logger name="org.springframework.http.codec.json.Jackson2JsonDecoder" level="debug" additivity="false">
<AppenderRef ref="Console"/>
</Logger>
<Logger name="org.springframework.http.codec.json.Jackson2JsonEncoder" level="debug" additivity="false">
<AppenderRef ref="Console"/>
</Logger>
<logger name="reactor.netty.http.server.AccessLog" level="info" additivity="false">
<appender-ref ref="Console"/>
</logger>
<Root level="info">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%c{1}): %msg%n%throwable
</Pattern>
</layout>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View file

@ -16,7 +16,7 @@ import com.provectus.kafka.ui.model.TaskIdDTO;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -27,7 +27,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.web.reactive.server.WebTestClient;
@ContextConfiguration(initializers = {AbstractBaseTest.Initializer.class})
@Log4j2
@Slf4j
@AutoConfigureWebTestClient(timeout = "60000")
public class KafkaConnectServiceTests extends AbstractBaseTest {
private final String connectName = "kafka-connect";

View file

@ -4,7 +4,7 @@ import java.time.Duration;
import java.util.List;
import java.util.Properties;
import java.util.UUID;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.apache.kafka.clients.admin.NewTopic;
import org.apache.kafka.clients.consumer.ConsumerConfig;
@ -18,7 +18,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.web.reactive.server.WebTestClient;
@ContextConfiguration(initializers = {AbstractBaseTest.Initializer.class})
@Log4j2
@Slf4j
@AutoConfigureWebTestClient(timeout = "10000")
public class KafkaConsumerGroupTests extends AbstractBaseTest {
@Autowired

View file

@ -15,7 +15,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Stream;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@ -24,7 +24,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.web.reactive.server.WebTestClient;
@ContextConfiguration(initializers = {AbstractBaseTest.Initializer.class})
@Log4j2
@Slf4j
@AutoConfigureWebTestClient(timeout = "60000")
public class KafkaConsumerTests extends AbstractBaseTest {

View file

@ -2,7 +2,7 @@ package com.provectus.kafka.ui;
import com.provectus.kafka.ui.model.TopicCreationDTO;
import java.util.UUID;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@ -11,7 +11,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.web.reactive.server.WebTestClient;
@ContextConfiguration(initializers = {AbstractBaseTest.Initializer.class})
@Log4j2
@Slf4j
@AutoConfigureWebTestClient(timeout = "10000")
public class KafkaTopicCreateTests extends AbstractBaseTest {
@Autowired

View file

@ -4,7 +4,7 @@ import com.provectus.kafka.ui.model.TopicCreationDTO;
import com.provectus.kafka.ui.model.TopicUpdateDTO;
import java.util.Map;
import java.util.UUID;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
@ -13,7 +13,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.web.reactive.server.WebTestClient;
@ContextConfiguration(initializers = {AbstractBaseTest.Initializer.class})
@Log4j2
@Slf4j
@AutoConfigureWebTestClient(timeout = "60000")
public class ReadOnlyModeTests extends AbstractBaseTest {

View file

@ -6,7 +6,7 @@ import com.provectus.kafka.ui.model.SchemaSubjectDTO;
import com.provectus.kafka.ui.model.SchemaTypeDTO;
import java.util.List;
import java.util.UUID;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@ -22,7 +22,7 @@ import org.springframework.web.reactive.function.BodyInserters;
import reactor.core.publisher.Mono;
@ContextConfiguration(initializers = {AbstractBaseTest.Initializer.class})
@Log4j2
@Slf4j
@AutoConfigureWebTestClient(timeout = "10000")
class SchemaRegistryServiceTests extends AbstractBaseTest {
@Autowired

View file

@ -26,7 +26,7 @@ import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
import lombok.Value;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.admin.NewTopic;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.KafkaConsumer;
@ -41,7 +41,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.test.context.ContextConfiguration;
import reactor.core.publisher.Flux;
@Log4j2
@Slf4j
@ContextConfiguration(initializers = {AbstractBaseTest.Initializer.class})
class RecordEmitterTest extends AbstractBaseTest {

View file

@ -9,7 +9,7 @@ import com.provectus.kafka.ui.steps.Steps;
import io.github.cdimascio.dotenv.Dotenv;
import io.qameta.allure.selenide.AllureSelenide;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.DisplayNameGeneration;
@ -22,7 +22,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Arrays;
@Log4j2
@Slf4j
@DisplayNameGeneration(CamelCaseToSpacedDisplayNameGenerator.class)
public class BaseTest {