Skip to content

Commit

Permalink
remove log4j dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
AnonHxy committed Jul 28, 2024
1 parent 79585ff commit 1eadbd1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 0 additions & 4 deletions bookkeeper-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
<artifactId>bookkeeper-common</artifactId>
<name>Apache BookKeeper :: Common</name>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.bookkeeper.stats</groupId>
<artifactId>bookkeeper-stats-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.concurrent.CompletableFuture;
import lombok.extern.slf4j.Slf4j;
import org.apache.bookkeeper.common.concurrent.FutureUtils;
import org.apache.logging.log4j.LogManager;

/**
* Utils to start components.
Expand Down Expand Up @@ -51,8 +50,6 @@ public void run() {
log.error("Failed to close component {} in shutdown hook gracefully, Exiting anyway",
component.getName(), e);
future.completeExceptionally(e);
} finally {
LogManager.shutdown();
}
}

Expand All @@ -77,8 +74,9 @@ public static CompletableFuture<Void> startComponent(LifecycleComponent componen
component.setExceptionHandler((t, e) -> {
log.error("Triggered exceptionHandler of Component: {} because of Exception in Thread: {}",
component.getName(), t, e);
System.err.println(e.getMessage());
// start the shutdown hook when an uncaught exception happen in the lifecycle component.
FutureUtils.complete(future, null);
shutdownHookThread.start();
});

component.publishInfo(new ComponentInfoPublisher());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.logging.log4j.LogManager;
import org.apache.zookeeper.KeeperException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -340,7 +339,7 @@ static int doMain(String[] args) {
server = buildAutoRecoveryServer(new BookieConfiguration(conf));
} catch (Exception e) {
LOG.error("Failed to build AutoRecovery Server", e);
LogManager.shutdown();
System.err.println(e.getMessage());
return ExitCode.SERVER_EXCEPTION;
}

Expand All @@ -351,8 +350,10 @@ static int doMain(String[] args) {
Thread.currentThread().interrupt();
// the server is interrupted
LOG.info("AutoRecovery server is interrupted. Exiting ...");
System.err.println(ie.getMessage());
} catch (ExecutionException ee) {
LOG.error("Error in bookie shutdown", ee.getCause());
System.err.println(ee.getMessage());
return ExitCode.SERVER_EXCEPTION;
}
return ExitCode.OK;
Expand Down

0 comments on commit 1eadbd1

Please sign in to comment.