Cleaned up logging

This commit is contained in:
Erik C. Thauvin 2023-10-30 16:53:11 -07:00
parent ed86a98335
commit 58a2245840
6 changed files with 19 additions and 13 deletions

View file

@ -1,4 +1,4 @@
# [bld](https://rife2.com/bld) Extension to Help Create [Spring Boot](https://spring.io/projects/spring-boot) Web Applications
# [b<span style="color:orange">l</span>d](https://rife2.com/bld) Extension to Help Create [Spring Boot](https://spring.io/projects/spring-boot) Web Applications
[![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

View file

@ -40,7 +40,11 @@ public class DemoApplicationBuild extends WebProject {
public static void main(String[] args) {
var logger = Logger.getLogger("rife.bld.extension");
logger.setLevel(Level.FINER);
ConsoleHandler consoleHandler = new ConsoleHandler();
consoleHandler.setLevel(Level.ALL);
logger.addHandler(consoleHandler);
logger.setLevel(Level.ALL);
logger.setUseParentHandlers(false);
new DemoApplicationBuild().start(args);
}

View file

@ -24,7 +24,8 @@ import rife.bld.publish.PublishScm;
import java.util.List;
import static rife.bld.dependencies.Repository.*;
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
import static rife.bld.dependencies.Repository.RIFE2_RELEASES;
import static rife.bld.dependencies.Scope.compile;
import static rife.bld.dependencies.Scope.test;
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;

View file

@ -174,8 +174,9 @@ public abstract class AbstractBootOperation<T extends AbstractBootOperation<T>>
* Part of the {@link #execute} operation, create the archive from the staging directory.
*
* @param stagingDirectory the staging directory
* @return the archive
*/
protected void executeCreateArchive(File stagingDirectory)
protected File executeCreateArchive(File stagingDirectory)
throws IOException {
executeCreateManifest(stagingDirectory);
if (LOGGER.isLoggable(Level.FINE) && (!silent())) {
@ -199,9 +200,9 @@ public abstract class AbstractBootOperation<T extends AbstractBootOperation<T>>
args = "-0cMf";
}
jarTool.run(stdout, stderr, args,
new File(destinationDirectory(), destinationFileName()).getAbsolutePath(),
"-C", stagingDirectory.getAbsolutePath(), ".");
var archive = new File(destinationDirectory(), destinationFileName());
jarTool.run(stdout, stderr, args, archive.getAbsolutePath(), "-C", stagingDirectory.getAbsolutePath(), ".");
var errBuff = err.getBuffer();
if (!errBuff.isEmpty()) {
@ -212,6 +213,8 @@ public abstract class AbstractBootOperation<T extends AbstractBootOperation<T>>
LOGGER.info(outBuff.toString());
}
}
return archive;
}
/**

View file

@ -50,11 +50,10 @@ public class BootJarOperation extends AbstractBootOperation<BootJarOperation> {
executeCopyInfLibs(boot_inf_dir);
executeCopyBootLoader(staging_dir);
executeCreateArchive(staging_dir);
var archive = executeCreateArchive(staging_dir);
if (!silent() && LOGGER.isLoggable(Level.INFO)) {
LOGGER.info(String.format("The executable JAR (%s) was created in: %s%n", destinationFileName(),
destinationDirectory()));
LOGGER.info("The executable JAR was created: " + archive.getAbsolutePath());
}
} finally {
FileUtils.deleteDirectory(staging_dir);

View file

@ -54,11 +54,10 @@ public class BootWarOperation extends AbstractBootOperation<BootWarOperation> {
executeCopyWebInfProvidedLib(web_inf_dir);
executeCopyBootLoader(staging_dir);
executeCreateArchive(staging_dir);
var archive = executeCreateArchive(staging_dir);
if (!silent() && LOGGER.isLoggable(Level.INFO)) {
LOGGER.info(String.format("The executable WAR (%s) was created in: %s%n", destinationFileName(),
destinationDirectory()));
LOGGER.info("The executable WAR was created: " + archive.getAbsolutePath());
}
} finally {
FileUtils.deleteDirectory(staging_dir);