This is an automated email from the ASF dual-hosted git repository.
gitgabrio pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-kogito-apps.git
The following commit(s) were added to refs/heads/main by this push:
new ef4671f2b [incubator-kie-issues#1263] Enable conditional debug logging
for jitexecutor-bpmn. (#2063)
ef4671f2b is described below
commit ef4671f2b4c78b70cf6342de964664a27e28b7e0
Author: Gabriele Cardosi <[email protected]>
AuthorDate: Mon May 27 09:16:06 2024 +0200
[incubator-kie-issues#1263] Enable conditional debug logging for
jitexecutor-bpmn. (#2063)
Co-authored-by: Gabriele-Cardosi <[email protected]>
---
jitexecutor/README.md | 13 +++++++++++
.../README.md | 6 ++---
jitexecutor/jitexecutor-bpmn/pom.xml | 27 ++++++++++++++++++++++
.../application.properties | 2 ++
.../bpmn/api/BPMNValidationResource.java | 10 ++++++++
.../kie/kogito/jitexecutor/common/Constants.java | 27 ++++++++++++++++++++++
jitexecutor/jitexecutor-dmn/README.md | 4 ++--
jitexecutor/jitexecutor-dmn/pom.xml | 2 +-
.../main/filtered-resources/application.properties | 2 +-
.../jitexecutor/dmn/api/DMNValidationResource.java | 4 ++--
.../kogito/jitexecutor/dmn/api/JITDMNResource.java | 2 +-
.../kogito/jitexecutor/dmn/api/SchemaResource.java | 10 ++++++++
.../org/kie/kogito/jitexecutor/dmn/DMN15Test.java | 12 +++++-----
13 files changed, 105 insertions(+), 16 deletions(-)
diff --git a/jitexecutor/README.md b/jitexecutor/README.md
index bcb41dce2..a5fbcde11 100644
--- a/jitexecutor/README.md
+++ b/jitexecutor/README.md
@@ -34,6 +34,19 @@ run the generated application under
`jitexecutor-runner/target/quarkus-app/` wit
java -jar jitexecutor-runner/target/quarkus-app/quarkus-run.jar
```
+Log configuration
+=================
+
+Rest endpoints have log configuration to eventually print out received
payload, if log is set to DEBUG level (default is INFO).
+This is managed in the application.properties, that is under
filtered-resources.
+The `quarkus.log.category."org.kie.kogito".level` is set from
`${jitexecutor.log.level}`, that by default is "INFO" in the pom.xml.
+
+It can be overridden with commandline parameter, e.g.
+
+```bash
+mvn clean package -Djitexecutor.log.level=DEBUG
+```
+
DMN
===
diff --git a/jitexecutor/jitexecutor-dmn/README.md
b/jitexecutor/jitexecutor-bpmn/README.md
similarity index 88%
copy from jitexecutor/jitexecutor-dmn/README.md
copy to jitexecutor/jitexecutor-bpmn/README.md
index d766a0da4..09ae6c871 100644
--- a/jitexecutor/jitexecutor-dmn/README.md
+++ b/jitexecutor/jitexecutor-bpmn/README.md
@@ -16,14 +16,14 @@
specific language governing permissions and limitations
under the License.
-->
-# Kogito JIT DMN Executor
+# Kogito JIT BPMN Executor
## Log configuration
Rest endpoints have log configuration to eventually print out received
payload, if log is set to DEBUG level (default is INFO).
This is managed in the application.properties, that is under
filtered-resources.
-The `quarkus.log.category."org.kie.kogito".level` is set from
`${jitexecutor.dmn.log.level}`, that by default is "INFO" in the pom.xml.
+The `quarkus.log.category."org.kie.kogito".level` is set from
`${jitexecutor.log.level}`, that by default is "INFO" in the pom.xml.
It can be overridden with commandline parameter, e.g.
-`mvn clean package -Djitexecutor.dmn.log.level=DEBUG`
+`mvn clean package -Djitexecutor.log.level=DEBUG`
diff --git a/jitexecutor/jitexecutor-bpmn/pom.xml
b/jitexecutor/jitexecutor-bpmn/pom.xml
index ba267ce74..21b148258 100644
--- a/jitexecutor/jitexecutor-bpmn/pom.xml
+++ b/jitexecutor/jitexecutor-bpmn/pom.xml
@@ -34,6 +34,7 @@
<properties>
<java.module.name>org.kie.kogito.jitexecutor.bpmn</java.module.name>
+ <jitexecutor.log.level>INFO</jitexecutor.log.level>
</properties>
<dependencyManagement>
@@ -88,4 +89,30 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-filtered-resources</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+
<outputDirectory>${project.build.directory}/classes</outputDirectory>
+ <resources>
+ <resource>
+
<directory>${project.basedir}/src/main/filtered-resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
\ No newline at end of file
diff --git
a/jitexecutor/jitexecutor-bpmn/src/main/resources/application.properties
b/jitexecutor/jitexecutor-bpmn/src/main/filtered-resources/application.properties
similarity index 91%
rename from
jitexecutor/jitexecutor-bpmn/src/main/resources/application.properties
rename to
jitexecutor/jitexecutor-bpmn/src/main/filtered-resources/application.properties
index f43a8a1a7..a04127cb8 100644
--- a/jitexecutor/jitexecutor-bpmn/src/main/resources/application.properties
+++
b/jitexecutor/jitexecutor-bpmn/src/main/filtered-resources/application.properties
@@ -24,5 +24,7 @@
# quarkus.log.category."org".level=INFO
+quarkus.log.category."org.kie.kogito".level=${jitexecutor.log.level}
+
# To avoid errors such as:
# Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException:
Discovered unresolved type during parsing: (full_name_of_the_class). To
diagnose the issue you can use the --allow-incomplete-classpath option. The
missing type is then reported at run time when it is accessed the first time.
\ No newline at end of file
diff --git
a/jitexecutor/jitexecutor-bpmn/src/main/java/org/kie/kogito/jitexecutor/bpmn/api/BPMNValidationResource.java
b/jitexecutor/jitexecutor-bpmn/src/main/java/org/kie/kogito/jitexecutor/bpmn/api/BPMNValidationResource.java
index aa28edef9..96e8ec7d3 100644
---
a/jitexecutor/jitexecutor-bpmn/src/main/java/org/kie/kogito/jitexecutor/bpmn/api/BPMNValidationResource.java
+++
b/jitexecutor/jitexecutor-bpmn/src/main/java/org/kie/kogito/jitexecutor/bpmn/api/BPMNValidationResource.java
@@ -21,6 +21,8 @@ package org.kie.kogito.jitexecutor.bpmn.api;
import org.kie.kogito.jitexecutor.bpmn.JITBPMNService;
import org.kie.kogito.jitexecutor.bpmn.responses.JITBPMNValidationResult;
import org.kie.kogito.jitexecutor.common.requests.MultipleResourcesPayload;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import jakarta.inject.Inject;
import jakarta.ws.rs.Consumes;
@@ -30,9 +32,13 @@ import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
+import static org.kie.kogito.jitexecutor.common.Constants.LINEBREAK;
+
@Path("jitbpmn/validate")
public class BPMNValidationResource {
+ private static final Logger LOGGER =
LoggerFactory.getLogger(BPMNValidationResource.class);
+
@Inject
JITBPMNService jitbpmnService;
@@ -40,6 +46,10 @@ public class BPMNValidationResource {
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response schema(MultipleResourcesPayload payload) {
+ LOGGER.debug(LINEBREAK);
+ LOGGER.debug("jitbpmn/validate");
+ LOGGER.debug(payload.toString());
+ LOGGER.debug(LINEBREAK);
JITBPMNValidationResult result =
jitbpmnService.validatePayload(payload);
return Response.ok(result.getErrors()).build();
}
diff --git
a/jitexecutor/jitexecutor-common/src/main/java/org/kie/kogito/jitexecutor/common/Constants.java
b/jitexecutor/jitexecutor-common/src/main/java/org/kie/kogito/jitexecutor/common/Constants.java
new file mode 100644
index 000000000..ed8079006
--- /dev/null
+++
b/jitexecutor/jitexecutor-common/src/main/java/org/kie/kogito/jitexecutor/common/Constants.java
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.jitexecutor.common;
+
+public class Constants {
+
+ public static final String LINEBREAK = "******\n";
+
+ private Constants() {
+ }
+}
\ No newline at end of file
diff --git a/jitexecutor/jitexecutor-dmn/README.md
b/jitexecutor/jitexecutor-dmn/README.md
index d766a0da4..a814beedc 100644
--- a/jitexecutor/jitexecutor-dmn/README.md
+++ b/jitexecutor/jitexecutor-dmn/README.md
@@ -22,8 +22,8 @@
Rest endpoints have log configuration to eventually print out received
payload, if log is set to DEBUG level (default is INFO).
This is managed in the application.properties, that is under
filtered-resources.
-The `quarkus.log.category."org.kie.kogito".level` is set from
`${jitexecutor.dmn.log.level}`, that by default is "INFO" in the pom.xml.
+The `quarkus.log.category."org.kie.kogito".level` is set from
`${jitexecutor.log.level}`, that by default is "INFO" in the pom.xml.
It can be overridden with commandline parameter, e.g.
-`mvn clean package -Djitexecutor.dmn.log.level=DEBUG`
+`mvn clean package -Djitexecutor.log.level=DEBUG`
diff --git a/jitexecutor/jitexecutor-dmn/pom.xml
b/jitexecutor/jitexecutor-dmn/pom.xml
index daffe13eb..f38b164c8 100644
--- a/jitexecutor/jitexecutor-dmn/pom.xml
+++ b/jitexecutor/jitexecutor-dmn/pom.xml
@@ -32,7 +32,7 @@
<properties>
<java.module.name>org.kie.kogito.jitexecutor.dmn</java.module.name>
- <jitexecutor.dmn.log.level>INFO</jitexecutor.dmn.log.level>
+ <jitexecutor.log.level>INFO</jitexecutor.log.level>
</properties>
<dependencyManagement>
diff --git
a/jitexecutor/jitexecutor-dmn/src/main/filtered-resources/application.properties
b/jitexecutor/jitexecutor-dmn/src/main/filtered-resources/application.properties
index ea6443155..cf51111cc 100644
---
a/jitexecutor/jitexecutor-dmn/src/main/filtered-resources/application.properties
+++
b/jitexecutor/jitexecutor-dmn/src/main/filtered-resources/application.properties
@@ -24,7 +24,7 @@
# quarkus.log.category."org".level=INFO
-quarkus.log.category."org.kie.kogito".level=${jitexecutor.dmn.log.level}
+quarkus.log.category."org.kie.kogito".level=${jitexecutor.log.level}
# To avoid errors such as:
# Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException:
Discovered unresolved type during parsing:
org.kie.pmml.pmml_4_2.PMMLRequestDataBuilder. To diagnose the issue you can use
the --allow-incomplete-classpath option. The missing type is then reported at
run time when it is accessed the first time.
diff --git
a/jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/DMNValidationResource.java
b/jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/DMNValidationResource.java
index fd2a31e0b..daa5208ff 100644
---
a/jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/DMNValidationResource.java
+++
b/jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/DMNValidationResource.java
@@ -45,13 +45,13 @@ import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
+import static org.kie.kogito.jitexecutor.common.Constants.LINEBREAK;
+
@Path("jitdmn/validate")
public class DMNValidationResource {
private static final Logger LOGGER =
LoggerFactory.getLogger(DMNValidationResource.class);
- static final String LINEBREAK = "******\n";
-
// trick for resolver/implementation for NI
static final DMNValidator validator =
DMNValidatorFactory.newValidator(List.of(new ExtendedDMNProfile()));
diff --git
a/jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/JITDMNResource.java
b/jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/JITDMNResource.java
index b99739c54..69d4eb8b8 100644
---
a/jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/JITDMNResource.java
+++
b/jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/JITDMNResource.java
@@ -38,7 +38,7 @@ import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
-import static
org.kie.kogito.jitexecutor.dmn.api.DMNValidationResource.LINEBREAK;
+import static org.kie.kogito.jitexecutor.common.Constants.LINEBREAK;
@Path("/jitdmn")
public class JITDMNResource {
diff --git
a/jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/SchemaResource.java
b/jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/SchemaResource.java
index b769aaa38..b1ce72029 100644
---
a/jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/SchemaResource.java
+++
b/jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/SchemaResource.java
@@ -33,6 +33,8 @@ import org.kie.dmn.openapi.DMNOASGeneratorFactory;
import org.kie.dmn.openapi.model.DMNOASResult;
import org.kie.kogito.jitexecutor.common.requests.MultipleResourcesPayload;
import org.kie.kogito.jitexecutor.dmn.DMNEvaluator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -46,9 +48,13 @@ import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
+import static org.kie.kogito.jitexecutor.common.Constants.LINEBREAK;
+
@Path("jitdmn/schema")
public class SchemaResource {
+ private static final Logger LOGGER =
LoggerFactory.getLogger(SchemaResource.class);
+
// trick for resolver/implementation for NI
static final OpenAPI x;
static Schema resourceWithURI;
@@ -65,6 +71,10 @@ public class SchemaResource {
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_JSON)
public Response schema(String payload) {
+ LOGGER.debug(LINEBREAK);
+ LOGGER.debug("jitdmn/validate");
+ LOGGER.debug(payload);
+ LOGGER.debug(LINEBREAK);
DMNModel dmnModel = DMNEvaluator.fromXML(payload).getDmnModel();
DMNOASResult oasResult =
DMNOASGeneratorFactory.generator(Collections.singletonList(dmnModel)).build();
return fullSchema(dmnModel, oasResult, true);
diff --git
a/jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/DMN15Test.java
b/jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/DMN15Test.java
index 8c017a028..de5793812 100644
---
a/jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/DMN15Test.java
+++
b/jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/DMN15Test.java
@@ -80,7 +80,7 @@ class DMN15Test {
Map<String, Object> context =
Map.of("p1", Map.of("Name", "P3", "Interests",
Arrays.asList("Ski")));
JITDMNPayload jitdmnpayload = new JITDMNPayload(modelRef,
List.of(model),
- context);
+ context);
given()
.contentType(ContentType.JSON)
.body(jitdmnpayload)
@@ -97,7 +97,7 @@ class DMN15Test {
Map<String, Object> context =
Map.of("p1", Map.of("Name", "P3", "Interests",
Arrays.asList("Ski", "Golf")));
JITDMNPayload jitdmnpayload = new JITDMNPayload(modelRef,
List.of(model),
- context);
+ context);
given()
.contentType(ContentType.JSON)
.body(jitdmnpayload)
@@ -114,7 +114,7 @@ class DMN15Test {
Map<String, Object> context =
Map.of("p1", Map.of("Name", "P3", "Interests",
Arrays.asList("Golf")));
JITDMNPayload jitdmnpayload = new JITDMNPayload(modelRef,
List.of(model),
- context);
+ context);
given()
.contentType(ContentType.JSON)
.body(jitdmnpayload)
@@ -126,7 +126,7 @@ class DMN15Test {
context =
Map.of("p1", Map.of("Name", "P3", "Interests",
Arrays.asList("Golf", "Jogging")));
jitdmnpayload = new JITDMNPayload(modelRef, List.of(model),
- context);
+ context);
given()
.contentType(ContentType.JSON)
.body(jitdmnpayload)
@@ -143,7 +143,7 @@ class DMN15Test {
Map<String, Object> context =
Map.of("p1", Map.of("Name", "P3", "Interests",
Arrays.asList("Ski")));
JITDMNPayload jitdmnpayload = new JITDMNPayload(modelRef,
List.of(model),
- context);
+ context);
given()
.contentType(ContentType.JSON)
.body(jitdmnpayload)
@@ -213,7 +213,7 @@ class DMN15Test {
Map<String, Object> context =
Map.of("A Person", Map.of("name", "John", "age", 47));
JITDMNPayload jitdmnpayload = new JITDMNPayload(importingModelRef,
List.of(model1, model2),
- context);
+ context);
given()
.contentType(ContentType.JSON)
.body(jitdmnpayload)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]