Skip to content

Commit

Permalink
fix: log conf & fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
wl4g committed Jun 27, 2024
1 parent f503739 commit e2783da
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected List<ObjectResource> loadScriptResources(
boolean usingCache) {
notNullOf(workflowId, "workflowId");
notNullOf(rule, "rule");
log.debug("Loading script {} by workflowId: {}, ruleId: {}", workflowId, rule.getId());
log.debug("Loading script by workflowId: {}, ruleId: {}", workflowId, rule.getId());

// Add upload object script dependencies all by scenes.workflow.rules
final var ruleScript = rule.getEffectiveLatestScript();
Expand All @@ -164,7 +164,7 @@ protected List<ObjectResource> loadScriptResources(
// Notice: According to the graal context eval mechanism, if there is a
// function with the same name, the latter will overwrite the previous
// eval function, so make sure that the main script is the last one.
Collections.sort(scriptObjects, (o1, o2) -> o1.getUploadId() == ruleScript.getEntrypointUploadId() ? 1 : -1);
scriptObjects.sort((o1, o2) -> o1.getUploadId() == ruleScript.getEntrypointUploadId() ? 1 : -1);

return scriptObjects;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;

import javax.enterprise.event.Observes;
Expand Down Expand Up @@ -106,14 +107,14 @@ void onStart(@Observes StartupEvent event) {
.connectTimeout(httpClient.connectTimeout().toMillis(), TimeUnit.MILLISECONDS)
.writeTimeout(config.httpClient().readTimeout().toMillis(), TimeUnit.MILLISECONDS)
.readTimeout(config.httpClient().writeTimeout().toMillis(), TimeUnit.MILLISECONDS)
.protocols(Arrays.asList(Protocol.HTTP_1_1))
.protocols(List.of(Protocol.HTTP_1_1))
.proxy(proxy)
.build());
if (isBlank(config.region())) {
builder.region(config.region());
}
this.minioClient = builder.build();
log.info("Initializated Minio Client: {}", minioClient);
log.info("Initialized Minio Client: {}", minioClient);
}

public ObjectResource loadObject(
Expand All @@ -139,7 +140,7 @@ public ObjectResource loadObject(
if ((currentTimeMillis() - localFile.lastModified()) < objectCacheExpireMs) {
return new ObjectResource(uploadId, objectPrefix, binary, localFile, safeLongToInt(localFile.length()));
}
// Expired and clearup
// Expired and clear-up
if (!localFile.delete()) {
log.warn("Unable to remove expired script cached of {}", localFile);
}
Expand Down Expand Up @@ -234,9 +235,10 @@ public static class ObjectResource {
private @NotNull File localFile;
private int available;

@SuppressWarnings("all")
public byte[] readToBytes() throws IOException {
isTrue(available <= DEFAULT_EXECUTOR_S3_OBJECT_MAX_LIMIT, "Maximum file object readable limit exceeded: %s",
DEFAULT_EXECUTOR_S3_OBJECT_MAX_LIMIT);
isTrue(available <= DEFAULT_EXECUTOR_S3_OBJECT_MAX_LIMIT,
"Maximum file object readable limit exceeded: %s", DEFAULT_EXECUTOR_S3_OBJECT_MAX_LIMIT);
return Resources.toByteArray(localFile.toURI().toURL());
}

Expand Down
18 changes: 9 additions & 9 deletions executor/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ quarkus:
ssl-port: 28012
test-ssl-port: 28022
root-path: /
insecure-requests: enabled ## enabled|redirect|disabled
insecure-requests: enabled # enabled|redirect|disabled
cors: false
tls:
trust-all: false
Expand Down Expand Up @@ -93,7 +93,7 @@ quarkus:
enable: true
format: '%d{yyyy-dd-mm HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n'
## see: script/executor-env.sh#L71
path: /var/log/${quarkus.application.name}/${quarkus.application.name}.log
path: /tmp/log/${quarkus.application.name}/${quarkus.application.name}.log
async: false
#queue-length: 128
#overflow: block # block,discard
Expand Down Expand Up @@ -279,10 +279,10 @@ quarkus:
- redis://localhost:7380
- redis://localhost:7381
timeout: 10s
password: 'zzx!@#$%'
max-pool-size: 512 ## Default by 6
max-pool-waiting: 512 ## Default by 24
max-waiting-handlers: 2048 ## Default by 2048
password: 'bitnami'
max-pool-size: 512 # Default by 6
max-pool-waiting: 512 # Default by 24
max-waiting-handlers: 2048 # Default by 2048
max-nested-arrays: 32
pool-cleaner-interval: 30m
pool-recycle-timeout: 15s
Expand All @@ -300,7 +300,7 @@ quarkus:
lables: {}
annotations: {}

## Rengine evaluator configuration.
## Rengine executor configuration.
rengine:
executor:
services:
Expand Down Expand Up @@ -329,7 +329,7 @@ rengine:
per-executor-thread-pools: 2

minio:
endpoint: http://localhost:9000
endpoint: http://localhost:19000
region: us-east-1
bucket: rengine
access-key: rengine
Expand All @@ -341,4 +341,4 @@ minio:
proxy:
type: DIRECT
address: 127.0.0.1
port: 8118
port: 8118
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

/**
* {@link AbstractFlinkStreamingBase}
*
*
* @author James Wong &lt;wanglsir@gmail.com, 983708408@qq.com&gt;
* @date 2022-06-07 v3.0.0
* @since v1.0.0
Expand Down Expand Up @@ -161,7 +161,7 @@ protected AbstractFlinkStreamingBase() {

/**
* Parsing command arguments to {@link CommandLineFacade}.
*
*
* @param args
* @return
* @throws ParseException
Expand Down Expand Up @@ -204,22 +204,22 @@ protected AbstractFlinkStreamingBase parse(String[] args) throws ParseException

/**
* Configuring custom FLINK environment details.
*
*
* @return
*/
protected void customProps(Map<String, String> props) {
}

/**
* Create FLINK source.
*
*
* @return
*/
protected abstract <T, S extends SourceSplit, E> Source<T, S, E> createSource();

/**
* Configuring custom FLINK data stream.
*
*
* @return
*/
protected DataStream<?> customStream(DataStream<RengineEvent> dataStreamSource) {
Expand All @@ -232,14 +232,14 @@ protected DataStream<?> customStream(DataStream<RengineEvent> dataStreamSource)

/**
* Create FLINK sink.
*
*
* @return
*/
protected abstract Serializable createSink();

/**
* Handling job execution result.
*
*
* @param result
*/
protected void handleJobExecutionResult(JobExecutionResult result) {
Expand All @@ -248,7 +248,7 @@ protected void handleJobExecutionResult(JobExecutionResult result) {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void run() {
notNull(line, errmsg -> new IllegalStateException(errmsg),
notNull(line, IllegalStateException::new,
"Parse arguments are not initialized, must call #parse() before");

// Custom details.
Expand Down
3 changes: 2 additions & 1 deletion service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
<!-- see:com.wl4g.infra.core.logging.custom.logback.CustomLogbackConfigurer -->
<!-- see:org.springframework.boot.logging.logback.DefaultLogbackConfiguration.DefaultLogbackConfiguration -->
<appender name="fileout" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/var/log/${appName}/${appName}.log</file>
<!-- <file>/var/log/${appName}/${appName}.log</file>-->
<file>/tmp/log/${appName}/${appName}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
<cleanHistoryOnStart>false</cleanHistoryOnStart>
Expand Down

0 comments on commit e2783da

Please sign in to comment.