Skip to content

Commit 57569b1

Browse files
Feature2.4.16 (#288)
* change BootJobListener log level to trace * ServiceContext.reset() only reset data content, not status * ServiceContext.reset() only reset data content, not status * ServiceContext.reset() renamed to resetResponseData(), it only reset response data, not status * change BootJobListener log level to DEBUG (configurable in etc/boot.conf section 4.2 naming.log4j2.jboListenerLogLevel) * release 2.4.16
1 parent f16b856 commit 57569b1

File tree

5 files changed

+59
-41
lines changed

5 files changed

+59
-41
lines changed

pom.xml

+32-21
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>org.summerboot</groupId>
66
<artifactId>jexpress</artifactId>
7-
<version>2.4.15</version>
7+
<version>2.4.16</version>
88
<packaging>jar</packaging>
99
<name>Summer Boot jExpress</name>
1010
<description>Summer Boot jExpress focuses on solving non-functional and operational maintainability requirements,
@@ -60,12 +60,7 @@
6060
<id>release</id>
6161
<build>
6262
<plugins>
63-
<plugin>
64-
<!--for unit test-->
65-
<groupId>org.apache.maven.plugins</groupId>
66-
<artifactId>maven-surefire-plugin</artifactId>
67-
<version>3.5.0</version>
68-
</plugin>
63+
6964
<plugin>
7065
<groupId>org.apache.maven.plugins</groupId>
7166
<artifactId>maven-scm-plugin</artifactId>
@@ -91,7 +86,7 @@
9186
<plugin>
9287
<groupId>org.apache.maven.plugins</groupId>
9388
<artifactId>maven-javadoc-plugin</artifactId>
94-
<version>3.10.0</version>
89+
<version>3.10.1</version>
9590
<configuration>
9691
<source>17</source>
9792
<!-- <aggregate>true</aggregate>-->
@@ -130,7 +125,7 @@
130125
<plugin>
131126
<groupId>org.apache.maven.plugins</groupId>
132127
<artifactId>maven-gpg-plugin</artifactId>
133-
<version>3.2.5</version>
128+
<version>3.2.7</version>
134129
<executions>
135130
<execution>
136131
<phase>verify</phase>
@@ -185,12 +180,13 @@
185180
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
186181
<maven.compiler.source>17</maven.compiler.source>
187182
<maven.compiler.target>17</maven.compiler.target>
188-
<maven.clean.version>3.3.2</maven.clean.version>
189-
<maven.compiler.version>3.12.1</maven.compiler.version>
190-
<maven.dependency.version>3.6.1</maven.dependency.version>
191-
<maven.jar.version>3.3.0</maven.jar.version>
192-
<maven.resources.version>3.3.1</maven.resources.version>
193-
<maven-surefire.version>3.2.5</maven-surefire.version>
183+
<maven-clean.version>3.4.0</maven-clean.version>
184+
<maven-compiler.version>3.13.0</maven-compiler.version>
185+
<maven-dependency.version>3.8.0</maven-dependency.version>
186+
<maven-jar.version>3.4.2</maven-jar.version>
187+
<maven-resources.version>3.3.1</maven-resources.version>
188+
<maven-surefire.version>3.5.1</maven-surefire.version>
189+
<maven-install.version>3.1.3</maven-install.version>
194190
<!-- Commons -->
195191
<commons-lang3.version>3.17.0</commons-lang3.version>
196192
<commons-cli.version>1.9.0</commons-cli.version>
@@ -254,7 +250,7 @@
254250
<pdfbox.version>2.0.25</pdfbox.version>-->
255251
<!-- PDF - com.openhtmltopdf -->
256252
<openhtml.version>1.0.10</openhtml.version>
257-
<batik-transcoder.version>1.17</batik-transcoder.version>
253+
<batik-transcoder.version>1.18</batik-transcoder.version>
258254
<!-- PDF - iText -->
259255
<itext7-core.version>8.0.5</itext7-core.version>
260256
<itext7-html2pdf.version>5.0.5</itext7-html2pdf.version>
@@ -783,7 +779,7 @@
783779
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-clean-plugin -->
784780
<plugin>
785781
<artifactId>maven-clean-plugin</artifactId>
786-
<version>${maven.clean.version}</version>
782+
<version>${maven-clean.version}</version>
787783
<configuration>
788784
<filesets>
789785
<fileset>
@@ -825,31 +821,46 @@
825821
<plugin>
826822
<groupId>org.apache.maven.plugins</groupId>
827823
<artifactId>maven-dependency-plugin</artifactId>
828-
<version>${maven.dependency.version}</version>
824+
<version>${maven-dependency.version}</version>
825+
</plugin>
826+
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
827+
<plugin>
828+
<groupId>org.apache.maven.plugins</groupId>
829+
<artifactId>maven-compiler-plugin</artifactId>
830+
<version>${maven-compiler.version}</version>
829831
</plugin>
830832
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-jar-plugin -->
831833
<plugin>
832834
<groupId>org.apache.maven.plugins</groupId>
833835
<artifactId>maven-jar-plugin</artifactId>
834-
<version>${maven.jar.version}</version>
836+
<version>${maven-jar.version}</version>
835837
</plugin>
836838
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin -->
837839
<plugin>
838840
<groupId>org.apache.maven.plugins</groupId>
839841
<artifactId>maven-install-plugin</artifactId>
840-
<version>3.1.1</version>
842+
<version>${maven-install.version}</version>
841843
</plugin>
842844
<plugin>
843845
<groupId>org.apache.maven.plugins</groupId>
844846
<artifactId>maven-surefire-plugin</artifactId>
845847
<version>${maven-surefire.version}</version>
848+
<configuration>
849+
<argLine>-server -Xms1G -Xmx1G -XX:+UseG1GC -XX:+AlwaysPreTouch -Djava.awt.headless=true
850+
-Djna.nosys=true -Dfile.encoding=UTF-8
851+
-Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
852+
-Dopenssl -Dio.netty.leakDetectionLevel=advanced -Dio.netty.noUnsafe=true
853+
-Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0
854+
-Dio.netty.native.workdir=temp
855+
</argLine>
856+
</configuration>
846857
</plugin>
847858
</plugins>
848859
<pluginManagement>
849860
<plugins>
850861
<plugin>
851862
<artifactId>maven-resources-plugin</artifactId>
852-
<version>${maven.resources.version}</version>
863+
<version>${maven-resources.version}</version>
853864
</plugin>
854865
</plugins>
855866
</pluginManagement>

src/main/java/org/summerboot/jexpress/boot/BackOffice.java

+10
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.summerboot.jexpress.boot;
1717

18+
import org.apache.logging.log4j.Level;
1819
import org.summerboot.jexpress.boot.config.BootConfig;
1920
import org.summerboot.jexpress.boot.config.ConfigUtil;
2021
import org.summerboot.jexpress.boot.config.annotation.Config;
@@ -65,6 +66,7 @@ protected void loadCustomizedConfigs(File cfgFile, boolean isReal, ConfigUtil he
6566
tpe.shutdown();
6667
}, "ShutdownHook.BackOffice")
6768
);
69+
jboListenerLogLevel = Level.getLevel(jboListenerLogLevelString);
6870
}
6971

7072
@Override
@@ -253,6 +255,10 @@ public Map<Integer, Integer> getBootErrorCodeMapping() {
253255
@Config(key = "naming.log4j2.xml.var.appPackageName", defaultValue = "appPackageName")
254256
private String log4j2AppPackageName = "appPackageName";
255257

258+
@Config(key = "naming.log4j2.jboListenerLogLevel", defaultValue = "DEBUG")
259+
private String jboListenerLogLevelString = Level.DEBUG.toString();
260+
private Level jboListenerLogLevel = Level.DEBUG;
261+
256262
@ConfigHeader(title = "4.3 Default CLI Naming")
257263
@Config(key = "naming.cli.usage", defaultValue = "?")
258264
private String cliName_usage = "?";
@@ -461,4 +467,8 @@ public String getCliName_psv() {
461467
public String getMemoDelimiter() {
462468
return memoDelimiter;
463469
}
470+
471+
public Level getJobListenerLogLevel() {
472+
return jboListenerLogLevel;
473+
}
464474
}

src/main/java/org/summerboot/jexpress/boot/BootConstant.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.summerboot.jexpress.boot;
1717

18+
import org.apache.logging.log4j.Level;
19+
1820
import java.util.Random;
1921

2022
/**
@@ -25,7 +27,7 @@ public interface BootConstant {
2527
String APP_ID = String.format("%06d", new Random().nextInt(999999));
2628

2729
//version
28-
String VERSION = "jExpress 2.4.15";
30+
String VERSION = "jExpress 2.4.16";
2931
String JEXPRESS_PACKAGE_NAME = "org.summerboot.jexpress";
3032

3133
String DEFAULT_ADMIN_MM = "changeit";
@@ -99,5 +101,5 @@ public interface BootConstant {
99101
String SYS_PROP_LOGFILENAME = BackOffice.agent.getLog4j2LogFileName();//"appName"; // used by log4j2.xml ${sys:appappName} as log file name
100102
String SYS_PROP_SERVER_NAME = BackOffice.agent.getLog4j2ServerName();//"serverName"; // used by log4j2.xml ${hostName}
101103
String SYS_PROP_APP_PACKAGE_NAME = BackOffice.agent.getLog4j2AppPackageName();//"appPackageName"; // used by both log4j2.xml ${sys:appPackage} and JPAHibernateConfig to scan @Entity
102-
104+
Level JOB_LISTENER_LOG_LEVEL = BackOffice.agent.getJobListenerLogLevel();
103105
}

src/main/java/org/summerboot/jexpress/integration/quartz/BootJobListener.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.summerboot.jexpress.integration.quartz;
1717

18+
import org.apache.logging.log4j.Level;
1819
import org.apache.logging.log4j.LogManager;
1920
import org.apache.logging.log4j.Logger;
2021
import org.quartz.JobDataMap;
@@ -29,6 +30,7 @@
2930
import org.quartz.TriggerBuilder;
3031
import org.quartz.TriggerKey;
3132
import org.quartz.listeners.JobListenerSupport;
33+
import org.summerboot.jexpress.boot.BootConstant;
3234

3335
import java.util.Date;
3436

@@ -43,6 +45,8 @@ public class BootJobListener extends JobListenerSupport {
4345
public static final String FIXED_DELAY_DESC = "jExpress_FIXED_DELAY_DESC";
4446
protected static final String JOB_LISTENER_NAME = BootJobListener.class.getSimpleName();
4547

48+
private static Level level = BootConstant.JOB_LISTENER_LOG_LEVEL;
49+
4650
@Override
4751
public String getName() {
4852
return JOB_LISTENER_NAME;
@@ -57,7 +61,7 @@ public void jobWasExecuted(final JobExecutionContext context, final JobExecution
5761

5862
protected Date logNextFireTime(final JobExecutionContext context, final JobExecutionException exception) {
5963
Date nextFireTime = context.getNextFireTime();
60-
if (nextFireTime != null && log.isInfoEnabled()) {
64+
if (nextFireTime != null && log.isEnabled(level)) {
6165
StringBuilder sb = new StringBuilder();
6266
sb.append("Scheduled jobs next fire time by triggers: ");
6367
try {
@@ -66,7 +70,7 @@ protected Date logNextFireTime(final JobExecutionContext context, final JobExecu
6670
} catch (Throwable ex) {
6771
sb.append(ex);
6872
}
69-
log.info(() -> sb.toString());
73+
log.log(level, () -> sb.toString());
7074
}
7175
return nextFireTime;
7276
}
@@ -75,7 +79,7 @@ protected void scheduleFixedDelayJob(final JobExecutionContext context, final Jo
7579
JobDetail jobDetail = context.getJobDetail();
7680
JobDataMap jobData = jobDetail.getJobDataMap();
7781
if (!jobData.containsKey(FIXED_DELAY_VALUE)) {
78-
log.info("Scheduled jobs next fire time by triggers: none");
82+
log.log(level, "Scheduled jobs next fire time by triggers: none");
7983
return;
8084
}
8185

@@ -104,7 +108,7 @@ protected void scheduleFixedDelayJob(final JobExecutionContext context, final Jo
104108
.startAt(nextTime)
105109
.build();
106110
scheduler.rescheduleJob(currentTriggerKey, nextTrigger);
107-
log.info(desc + " scheduled@" + nextTime);
111+
log.log(level, desc + " scheduled@" + nextTime);
108112
} catch (SchedulerException ex) {
109113
log.error("failed to reschedule the job with triger: {}", currentTriggerKey, ex);
110114
}

src/main/java/org/summerboot/jexpress/nio/server/domain/ServiceContext.java

+5-14
Original file line numberDiff line numberDiff line change
@@ -233,27 +233,18 @@ public OffsetDateTime startDateTime() {
233233
return startDateTime;
234234
}
235235

236-
public ServiceContext reset() {
237-
status = HttpResponseStatus.OK;
238-
autoConvertBlank200To204 = true;
239-
// 1.4 data
240-
data = null;
236+
public ServiceContext resetResponseData() {
237+
// 1. data
241238
txt = "";
242239
file = null;
243240
redirect = null;
241+
data = null;
244242

245-
// 2.1 error
246-
// errorCode = 0;
247-
// errorTag = null;
248-
// cause = null;
243+
// 2. error
249244
serviceError = null;
250245
cause = null;
251-
// 2.2 logging control
246+
status = HttpResponseStatus.OK;
252247
level(Level.INFO);
253-
logRequestHeader = false;
254-
logResponseHeader = false;
255-
logRequestBody = false;
256-
logResponseBody = false;
257248
return this;
258249
}
259250

0 commit comments

Comments
 (0)