Skip to content

Commit fdaa081

Browse files
committed
Spring Boot startup with logging options
1 parent e050314 commit fdaa081

File tree

1 file changed

+38
-9
lines changed

1 file changed

+38
-9
lines changed

EasyKey.maven/ezk-maven-functions.sh

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
11
#!/bin/bash
22

33
enableLogging() {
4-
echo "SQL:"
4+
echo "Root logger (global default logging level):"
5+
echo "logging.level.root=warn"
6+
echo "Stuff in my app:"
7+
echo "logging.level.com.myapp=DEBUG"
8+
echo "All Spring:"
9+
echo "logging.level.org.springframework=DEBUG"
10+
echo "Spring Web:"
11+
echo "logging.level.org.springframework.web=debug"
12+
echo "Display endpoints at startup:"
13+
echo "logging.level.web=TRACE"
14+
echo "logging.level.web=DEBUG"
15+
echo "Rest:"
16+
echo "logging.group.rest=org.springframework.web,org.springframework.http"
17+
echo "logging.level.rest=DEBUG"
18+
echo "Tomcat:"
19+
echo "logging.group.tomcat=org.apache.catalina, org.apache.coyote, org.apache.tomcat"
20+
echo "logging.level.tomcat=DEBUG"
21+
echo "Hibernate:"
22+
echo "logging.level.org.hibernate=error"
23+
echo "Autoconfig:"
24+
echo "logging.level.org.springframework.boot.autoconfigure=DEBUG"
25+
echo "SQL"
26+
echo "logging.level.sql=DEBUG"
527
echo "logging:"
628
echo " level:"
729
echo " org: "
@@ -12,9 +34,11 @@ enableLogging() {
1234
echo " jdbc:"
1335
echo " datasource:"
1436
echo " init: DEBUG"
15-
echo "Autoconfig:"
16-
echo "logging.level.org.springframework=DEBUG"
17-
echo "logging.level.com.myapp=DEBUG"
37+
echo "JPA SQL:"
38+
echo "spring.jpa.show-sql=true"
39+
echo "With Actuator:"
40+
echo "management.endpoints.web.exposure.include=mappings"
41+
echo "http://localhost:8080/actuator/mappings"
1842
}
1943

2044
showProperties() {
@@ -32,11 +56,16 @@ mvnCleanEclipse(){
3256
startSpringBoot() {
3357
echo "Which profile? (optional)"
3458
read defprofiles
35-
if [ "$defprofiles" = "" ]; then
36-
mvn spring-boot:run
37-
else
38-
mvn spring-boot:run -Dspring-boot.run.profiles=$defprofiles
39-
fi
59+
defprofiles=-Dspring-boot.run.profiles=${defprofiles}
60+
my_array=("logging.level.web=DEBUG" \
61+
"logging.level.sql=DEBUG" \
62+
"logging.level.web=TRACE" \
63+
"logging.level.sql=TRACE" \
64+
"spring.jpa.show-sql=true")
65+
concatenated=$(printf "%s\n" "${my_array[@]}")
66+
selectItem 'printf "%s\n" "${my_array[@]}"' "awk '{print \$1}'"
67+
if [[ $fname == "" ]]; then return 0; fi
68+
mvn spring-boot:run -Dspring-boot.run.arguments=--"$fname" ${defprofiles}
4069
}
4170

4271
showGlobalSettings(){

0 commit comments

Comments
 (0)