Skip to content

Usage of System.out in Jetty GracefulShutdown #39359

@okohub

Description

@okohub

When using graceful shutdown with Jetty, current requests are written with system.out instead of logger. Was it intentional? Here is the code piece:

org.springframework.boot.web.embedded.jetty.GracefulShutdown#awaitShutdown

	private void awaitShutdown(GracefulShutdownCallback callback) {
		while (this.shuttingDown && this.activeRequests.get() > 0) {
			sleep(100);
		}
		System.out.println(this.activeRequests.get());
		this.shuttingDown = false;
		long activeRequests = this.activeRequests.get();
		if (activeRequests == 0) {
			logger.info("Graceful shutdown complete");
			callback.shutdownComplete(GracefulShutdownResult.IDLE);
		}
		else {
			logger.info(LogMessage.format("Graceful shutdown aborted with %d request(s) still active", activeRequests));
			callback.shutdownComplete(GracefulShutdownResult.REQUESTS_ACTIVE);
		}
	}

Looks like logger is already used in this method. I can fix it if ok.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by another

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions