Skip to content

Commit

Permalink
add ascii art and better log management, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
ZihengSun committed Jul 6, 2024
1 parent a2f5511 commit 4541074
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 43 deletions.
26 changes: 7 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>
<groupId>com.gw</groupId>
<artifactId>geoweaver</artifactId>
<version>1.6.1</version>
<version>1.6.2</version>
<name>geoweaver</name>
<description>A lightweight workflow management software for organizing data analysis workflows,
preserving history of every workflow run, and improving scientist producitvity and workflow FAIRness,
Expand Down Expand Up @@ -46,27 +46,15 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
</exclusions>
</dependency>

<dependency>
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/gw/GeoweaverApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down
13 changes: 8 additions & 5 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 13 additions & 18 deletions src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -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
37 changes: 37 additions & 0 deletions src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<!-- Define the pattern for log output -->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n" />

<!-- Define the log file location -->
<property name="LOG_FILE" value="${user.home}/geoweaver.log" />

<!-- Console appender configuration -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>

<!-- File appender configuration -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_FILE}</file>
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>logs/spring-boot-application.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
</appender>

<!-- Set the root logger level and attach appenders -->
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>

</configuration>
2 changes: 1 addition & 1 deletion src/main/resources/static/js/gw.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down

0 comments on commit 4541074

Please sign in to comment.