Skip to content

Commit

Permalink
Feature2.4.16 (#288)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
SummerBootFramework authored Oct 15, 2024
1 parent f16b856 commit 57569b1
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 41 deletions.
53 changes: 32 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.summerboot</groupId>
<artifactId>jexpress</artifactId>
<version>2.4.15</version>
<version>2.4.16</version>
<packaging>jar</packaging>
<name>Summer Boot jExpress</name>
<description>Summer Boot jExpress focuses on solving non-functional and operational maintainability requirements,
Expand Down Expand Up @@ -60,12 +60,7 @@
<id>release</id>
<build>
<plugins>
<plugin>
<!--for unit test-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.0</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
Expand All @@ -91,7 +86,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.10.0</version>
<version>3.10.1</version>
<configuration>
<source>17</source>
<!-- <aggregate>true</aggregate>-->
Expand Down Expand Up @@ -130,7 +125,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.5</version>
<version>3.2.7</version>
<executions>
<execution>
<phase>verify</phase>
Expand Down Expand Up @@ -185,12 +180,13 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.clean.version>3.3.2</maven.clean.version>
<maven.compiler.version>3.12.1</maven.compiler.version>
<maven.dependency.version>3.6.1</maven.dependency.version>
<maven.jar.version>3.3.0</maven.jar.version>
<maven.resources.version>3.3.1</maven.resources.version>
<maven-surefire.version>3.2.5</maven-surefire.version>
<maven-clean.version>3.4.0</maven-clean.version>
<maven-compiler.version>3.13.0</maven-compiler.version>
<maven-dependency.version>3.8.0</maven-dependency.version>
<maven-jar.version>3.4.2</maven-jar.version>
<maven-resources.version>3.3.1</maven-resources.version>
<maven-surefire.version>3.5.1</maven-surefire.version>
<maven-install.version>3.1.3</maven-install.version>
<!-- Commons -->
<commons-lang3.version>3.17.0</commons-lang3.version>
<commons-cli.version>1.9.0</commons-cli.version>
Expand Down Expand Up @@ -254,7 +250,7 @@
<pdfbox.version>2.0.25</pdfbox.version>-->
<!-- PDF - com.openhtmltopdf -->
<openhtml.version>1.0.10</openhtml.version>
<batik-transcoder.version>1.17</batik-transcoder.version>
<batik-transcoder.version>1.18</batik-transcoder.version>
<!-- PDF - iText -->
<itext7-core.version>8.0.5</itext7-core.version>
<itext7-html2pdf.version>5.0.5</itext7-html2pdf.version>
Expand Down Expand Up @@ -783,7 +779,7 @@
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-clean-plugin -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven.clean.version}</version>
<version>${maven-clean.version}</version>
<configuration>
<filesets>
<fileset>
Expand Down Expand Up @@ -825,31 +821,46 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven.dependency.version}</version>
<version>${maven-dependency.version}</version>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler.version}</version>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-jar-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven.jar.version}</version>
<version>${maven-jar.version}</version>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.1</version>
<version>${maven-install.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire.version}</version>
<configuration>
<argLine>-server -Xms1G -Xmx1G -XX:+UseG1GC -XX:+AlwaysPreTouch -Djava.awt.headless=true
-Djna.nosys=true -Dfile.encoding=UTF-8
-Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
-Dopenssl -Dio.netty.leakDetectionLevel=advanced -Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0
-Dio.netty.native.workdir=temp
</argLine>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven.resources.version}</version>
<version>${maven-resources.version}</version>
</plugin>
</plugins>
</pluginManagement>
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/org/summerboot/jexpress/boot/BackOffice.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.summerboot.jexpress.boot;

import org.apache.logging.log4j.Level;
import org.summerboot.jexpress.boot.config.BootConfig;
import org.summerboot.jexpress.boot.config.ConfigUtil;
import org.summerboot.jexpress.boot.config.annotation.Config;
Expand Down Expand Up @@ -65,6 +66,7 @@ protected void loadCustomizedConfigs(File cfgFile, boolean isReal, ConfigUtil he
tpe.shutdown();
}, "ShutdownHook.BackOffice")
);
jboListenerLogLevel = Level.getLevel(jboListenerLogLevelString);
}

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

@Config(key = "naming.log4j2.jboListenerLogLevel", defaultValue = "DEBUG")
private String jboListenerLogLevelString = Level.DEBUG.toString();
private Level jboListenerLogLevel = Level.DEBUG;

@ConfigHeader(title = "4.3 Default CLI Naming")
@Config(key = "naming.cli.usage", defaultValue = "?")
private String cliName_usage = "?";
Expand Down Expand Up @@ -461,4 +467,8 @@ public String getCliName_psv() {
public String getMemoDelimiter() {
return memoDelimiter;
}

public Level getJobListenerLogLevel() {
return jboListenerLogLevel;
}
}
6 changes: 4 additions & 2 deletions src/main/java/org/summerboot/jexpress/boot/BootConstant.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.summerboot.jexpress.boot;

import org.apache.logging.log4j.Level;

import java.util.Random;

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

//version
String VERSION = "jExpress 2.4.15";
String VERSION = "jExpress 2.4.16";
String JEXPRESS_PACKAGE_NAME = "org.summerboot.jexpress";

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

Level JOB_LISTENER_LOG_LEVEL = BackOffice.agent.getJobListenerLogLevel();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.summerboot.jexpress.integration.quartz;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.quartz.JobDataMap;
Expand All @@ -29,6 +30,7 @@
import org.quartz.TriggerBuilder;
import org.quartz.TriggerKey;
import org.quartz.listeners.JobListenerSupport;
import org.summerboot.jexpress.boot.BootConstant;

import java.util.Date;

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

private static Level level = BootConstant.JOB_LISTENER_LOG_LEVEL;

@Override
public String getName() {
return JOB_LISTENER_NAME;
Expand All @@ -57,7 +61,7 @@ public void jobWasExecuted(final JobExecutionContext context, final JobExecution

protected Date logNextFireTime(final JobExecutionContext context, final JobExecutionException exception) {
Date nextFireTime = context.getNextFireTime();
if (nextFireTime != null && log.isInfoEnabled()) {
if (nextFireTime != null && log.isEnabled(level)) {
StringBuilder sb = new StringBuilder();
sb.append("Scheduled jobs next fire time by triggers: ");
try {
Expand All @@ -66,7 +70,7 @@ protected Date logNextFireTime(final JobExecutionContext context, final JobExecu
} catch (Throwable ex) {
sb.append(ex);
}
log.info(() -> sb.toString());
log.log(level, () -> sb.toString());
}
return nextFireTime;
}
Expand All @@ -75,7 +79,7 @@ protected void scheduleFixedDelayJob(final JobExecutionContext context, final Jo
JobDetail jobDetail = context.getJobDetail();
JobDataMap jobData = jobDetail.getJobDataMap();
if (!jobData.containsKey(FIXED_DELAY_VALUE)) {
log.info("Scheduled jobs next fire time by triggers: none");
log.log(level, "Scheduled jobs next fire time by triggers: none");
return;
}

Expand Down Expand Up @@ -104,7 +108,7 @@ protected void scheduleFixedDelayJob(final JobExecutionContext context, final Jo
.startAt(nextTime)
.build();
scheduler.rescheduleJob(currentTriggerKey, nextTrigger);
log.info(desc + " scheduled@" + nextTime);
log.log(level, desc + " scheduled@" + nextTime);
} catch (SchedulerException ex) {
log.error("failed to reschedule the job with triger: {}", currentTriggerKey, ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,27 +233,18 @@ public OffsetDateTime startDateTime() {
return startDateTime;
}

public ServiceContext reset() {
status = HttpResponseStatus.OK;
autoConvertBlank200To204 = true;
// 1.4 data
data = null;
public ServiceContext resetResponseData() {
// 1. data
txt = "";
file = null;
redirect = null;
data = null;

// 2.1 error
// errorCode = 0;
// errorTag = null;
// cause = null;
// 2. error
serviceError = null;
cause = null;
// 2.2 logging control
status = HttpResponseStatus.OK;
level(Level.INFO);
logRequestHeader = false;
logResponseHeader = false;
logRequestBody = false;
logResponseBody = false;
return this;
}

Expand Down

0 comments on commit 57569b1

Please sign in to comment.