From 454107426e0c9669dc2b8d96cdfdf3606767fe95 Mon Sep 17 00:00:00 2001 From: Ziheng Sun Date: Sat, 6 Jul 2024 19:21:50 -0400 Subject: [PATCH] add ascii art and better log management, bump version --- pom.xml | 26 ++++--------- .../java/com/gw/GeoweaverApplication.java | 23 ++++++++++++ src/main/resources/application.properties | 13 ++++--- src/main/resources/log4j.properties | 31 +++++++--------- src/main/resources/logback-spring.xml | 37 +++++++++++++++++++ src/main/resources/static/js/gw.js | 2 +- 6 files changed, 89 insertions(+), 43 deletions(-) create mode 100644 src/main/resources/logback-spring.xml diff --git a/pom.xml b/pom.xml index 099c56920..107256f33 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ com.gw geoweaver - 1.6.1 + 1.6.2 geoweaver A lightweight workflow management software for organizing data analysis workflows, preserving history of every workflow run, and improving scientist producitvity and workflow FAIRness, @@ -46,27 +46,15 @@ org.springframework.boot spring-boot-starter-security - - org.slf4j - slf4j-api - - - org.slf4j - slf4j-api + + org.springframework.boot + spring-boot-starter-logging - + org.slf4j - slf4j-log4j12 - - - ch.qos.logback - logback-classic - - - log4j - log4j + log4j-over-slf4j - + diff --git a/src/main/java/com/gw/GeoweaverApplication.java b/src/main/java/com/gw/GeoweaverApplication.java index 39cf3dfa7..b30a5ed8a 100644 --- a/src/main/java/com/gw/GeoweaverApplication.java +++ b/src/main/java/com/gw/GeoweaverApplication.java @@ -63,6 +63,8 @@ public static void main(String[] args) { System.exit(1); } + show_ascii_art(); + ApplicationContext applicationContext = new SpringApplicationBuilder(GeoweaverApplication.class) .bannerMode(Banner.Mode.OFF) @@ -86,6 +88,27 @@ public Docket geoweaverAPI() { .build(); } + public static void show_ascii_art(){ + // ANSI escape codes for colors + String reset = "\u001B[0m"; + String yellow = "\u001B[33m"; + String green = "\u001B[32m"; + String blue = "\u001B[34m"; + String geoweaverArt = green+ "\n"+ + " ____ ___ ___ __ __ ___ ____ __ __ ___ ____\n"+ + " / T / _] / \\ | T__T T / _] / T| T | / _]| \\ \n" + + "Y __j / [_ Y Y| | | | / [_ Y o || | | / [_ | D )\n" + + "| T |Y _]| O || | | |Y _]| || | |Y _]| / \n" + + "| l_ || [_ | |l ` ' !| [_ | _ |l : !| [_ | \\ \n" + + "| || Tl ! \\ / | T| | | \\ / | T| . Y\n" + + "l___,_jl_____j \\___/ \\_/\\_/ l_____jl__j__j \\_/ l_____jl__j\\_j\n\n"+reset; + + // Print Geoweaver ASCII art name and additional art + System.out.println(blue + "Welcome to Geoweaver - A Workflow Tool for Research Productivity\n"); + System.out.println(geoweaverArt); + System.out.println("Geoweaver is rolling out of bed and warming up its gears. Hang on.. "); + } + public static void addLocalhost() { HostTool ht = BeanTool.getBean(HostTool.class); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 31f89c990..00ae1df8e 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -9,13 +9,16 @@ server.servlet.contextPath=/Geoweaver # logging.level.org.springframework.boot.autoconfigure=DEBUG # Log -logging.level.root=FATAL -logging.level.org.springframework=FATAL -logging.level.com.gw=FATAL -logging.level.org.hibernate=FATAL +# Set the path to the log file +logging.file.name=${user.home}/geoweaver.log +logging.level.root=INFO +logging.level.org.springframework=INFO +logging.level.com.gw=INFO +logging.level.org.hibernate=INFO +logging.level.org.apache.catalina=FATAL # import the external configuration file if exists -spring.config.import=optional:file:${HOME}/geoweaver/application.properties +spring.config.import=optional:file:${user.home}/geoweaver/application.properties ###### To use H2 Database diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties index c588396cd..97c5063bb 100644 --- a/src/main/resources/log4j.properties +++ b/src/main/resources/log4j.properties @@ -1,18 +1,13 @@ - - -log4j.rootLogger=FATAL,stdout -log4j.logger.com.gw=FATAL - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n - - - - -log4j.rootLogger=FATAL,stdout -log4j.logger.com.gw=DEBUG - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n +# Root logger configuration +log4j.rootLogger=INFO, file + +# Logger for your package +log4j.logger.com.gw=INFO + +# File appender configuration +log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.File=${user.home}/geoweaver.log +log4j.appender.file.MaxFileSize=10MB +log4j.appender.file.MaxBackupIndex=5 +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 000000000..c7b1f10d6 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + ${LOG_PATTERN} + + + + + + ${LOG_FILE} + + ${LOG_PATTERN} + + + + logs/spring-boot-application.%d{yyyy-MM-dd}.log + + 30 + + + + + + + + + + diff --git a/src/main/resources/static/js/gw.js b/src/main/resources/static/js/gw.js index 63c4bfc4a..df9d97cfc 100644 --- a/src/main/resources/static/js/gw.js +++ b/src/main/resources/static/js/gw.js @@ -9,7 +9,7 @@ edu = { sponsor: "ESIPLab incubator project, NASA ACCESS project, NSF Geoinformatics project, NSF Cybertraining project", - version: "1.6.1", + version: "1.6.2", author: "open source contributors",