diff --git a/json-logger/README.md b/json-logger/README.md
index 37abe8f..7d41542 100644
--- a/json-logger/README.md
+++ b/json-logger/README.md
@@ -1,31 +1,38 @@
-# Json-logger Extension
-
-## 2.0.1 version - Release notes
-
-Bug fixes:
-* Added support for large payloads
-
-## 2.0.0 version - Release notes
-
-New features:
-* External Destinations
-* Data masking
-
-Improvements:
-* Field ordering
-
-More details in the coming blog post (stay tuned!)
-
-## 1.1.0 version - Release notes
-
-New features:
-* Scoped loggers to capture "scope bound elapsed time". Great for performance tracking of specific components (e.g. outbound calls)
-* Added "Parse content fields in json output" flag so that content fields can become part of final JSON output rather than a "stringified version" of the content
-
-Improvements:
-* Removed Guava and caching in general with a more efficient handling of timers (for elapsed time)
-* Optimized generation of JSON output
-* Code optimizations
-* Minimized dependency footprint (down from ~23MB to ~13MB)
-* Optimized parsing of TypedValue content fields
-
+# Json-logger Extension for Mule 4 runtime
+
+Json logger makes uses of [Mule Java SDK](https://docs.mulesoft.com/mule-sdk/1.1/getting-started)
+and contains a custom deserializer for masking fields in the JSON.
+
+> Data masking is not possible in any other formats at this time e.g. xml, csv, etc.
+
+## Serialization/Deserialization performance penalty
+When the payload is passed into the json logger component as `application/json`, it is first deserialized
+and masking if specified is applied in place. The serialization takes place when the log is being written out.
+Therefore, at the very minimum, it is a two-step process. The transformation done before or after the json logger
+to convert payload to `application/java` from `application/json` and vice versa will degrade performance.
+
+## Operations:
+There are two operations available:
+1. logger: Use this for regular logging
+2. loggerScope: Use this to measure response times for external calls
+
+## Logging structure:
+```json
+ {
+ "correlationId" : "cbfb9c1f-f904-40f2-bad9-2eac6bc05e84",
+ "message" : "",
+ "content": {
+ "dateOfBirth": "**-**-****"
+ },
+ "priority" : "INFO",
+ "tracePoint" : "START",
+ "locationInfo" : {
+ "fileName" : "api-main-router.xml",
+ "rootContainer" : "api-main",
+ "lineNumber" : "25"
+ },
+ "applicationName" : "proc-checkin-api-v1",
+ "applicationVersion" : "1.2.7",
+ "environment" : "local"
+}
+```
\ No newline at end of file
diff --git a/json-logger/pom.xml b/json-logger/pom.xml
index f76e48d..2cf05f3 100644
--- a/json-logger/pom.xml
+++ b/json-logger/pom.xml
@@ -3,141 +3,64 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- 4.0.0
- ORG_ID_TOKEN
- json-logger
- 2.0.1
- mule-extension
- JSON Logger - Mule 4
+ 4.0.0
+ 7abbfaeb-3816-4907-865e-76d7cb24120f
+ json-logger
+ 3.0.0
+ mule-extension
+ JSON Logger - Mule 4
-
- org.mule.extensions
- mule-modules-parent
- 1.1.1
-
+
+ org.mule.extensions
+ mule-modules-parent
+ 1.1.1
+
-
-
-
- org.apache.maven.plugins
- maven-install-plugin
- 2.5.2
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
- 2.8.2
-
-
- org.jsonschema2pojo
- jsonschema2pojo-maven-plugin
- 0.4.35
-
-
- io.github.mulesoft-consulting
- jsonschema2pojo-mule-annotations
- 1.2.0
- compile
-
-
-
- org.mule.custom.annotation.utils.CustomMuleAnnotator
- ${basedir}/src/main/resources/schema
- ${project.build.directory}/generated-sources
- org.mule.extension.jsonlogger.api.pojos
-
-
-
-
- generate
-
-
-
-
-
-
+
+
+
+ org.apache.maven.plugins
+ maven-install-plugin
+ 2.5.2
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 2.8.2
+
-
-
-
- Exchange2
- Exchange2 Repository
- https://maven.anypoint.mulesoft.com/api/v1/organizations/${project.groupId}/maven
- default
-
-
+
+
-
-
- com.fasterxml.jackson.core
- jackson-databind
- 2.10.3
-
-
- commons-lang
- commons-lang
- 2.6
-
-
- commons-beanutils
- commons-beanutils
- 1.9.4
-
-
- joda-time
- joda-time
- 2.10.5
-
-
- org.mule.connectors
- mule-jms-connector
- 1.6.3
- mule-plugin
- provided
-
-
- com.mulesoft.connectors
- mule-amqp-connector
- 1.6.0
- mule-plugin
- provided
-
-
- com.mulesoft.muleesb.modules
- anypoint-mq-rest-client
- 3.1.0
-
-
- async-http-client
- com.ning
-
-
- compile
-
-
- com.jayway.jsonpath
- json-path
- 2.4.0
-
-
- org.slf4j
- slf4j-api
-
-
-
-
- com.lmax
- disruptor
- 3.4.2
-
-
-
-
-
- Exchange2
- Exchange2 Repository
- https://maven.anypoint.mulesoft.com/api/v1/organizations/${project.groupId}/maven
- default
-
-
+
+
+ Exchange2
+ Exchange2 Repository
+ https://maven.anypoint.mulesoft.com/api/v1/organizations/${project.groupId}/maven
+ default
+
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.10.3
+
+
+ org.apache.logging.log4j
+ log4j-slf4j-impl
+ 2.14.1
+ test
+
+
+
+
+
+ Exchange2
+ Exchange2 Repository
+ https://maven.anypoint.mulesoft.com/api/v1/organizations/${project.groupId}/maven
+ default
+
+
diff --git a/json-logger/pom.xml.original b/json-logger/pom.xml.original
deleted file mode 100644
index 519c6eb..0000000
--- a/json-logger/pom.xml.original
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
-
- 4.0.0
- ORG_ID_TOKEN
- json-logger
- 1.1.0
- mule-extension
- JSON Logger - Mule 4
-
-
- org.mule.extensions
- mule-modules-parent
- 1.1.1
-
-
-
-
-
- org.jsonschema2pojo
- jsonschema2pojo-maven-plugin
- 0.4.35
-
-
- cc568b69-a181-4d4c-b044-90054c52897b
- jsonschema2pojo-mule-annotations
- 1.0.0
-
-
-
- org.mule.custom.annotation.utils.CustomMuleAnnotator
- ${basedir}/src/main/resources/schema
- ${project.build.directory}/generated-sources
- org.mule.extension.jsonlogger.api.pojos
-
-
-
-
- generate
-
-
-
-
-
-
-
-
-
-
- Exchange2
- Exchange2 Repository
- https://maven.anypoint.mulesoft.com/api/v1/organizations/${project.groupId}/maven
- default
-
-
-
-
-
- org.jsonschema2pojo
- jsonschema2pojo-maven-plugin
- 0.4.35
-
-
- cc568b69-a181-4d4c-b044-90054c52897b
- jsonschema2pojo-mule-annotations
- 1.0.0
-
-
- com.google.guava
- guava
- 28.0-jre
-
-
-
-
-
- Exchange2-MulesoftServices
- Exchange2 Repository
- https://maven.anypoint.mulesoft.com/api/v1/organizations/cc568b69-a181-4d4c-b044-90054c52897b/maven
- default
-
-
-
-
-
- Exchange2-MulesoftServices
- Exchange2 Repository
- https://maven.anypoint.mulesoft.com/api/v1/organizations/cc568b69-a181-4d4c-b044-90054c52897b/maven
- default
-
-
-
diff --git a/json-logger/src/main/java/org/mule/extension/jsonlogger/Constants.java b/json-logger/src/main/java/org/mule/extension/jsonlogger/Constants.java
new file mode 100644
index 0000000..591885f
--- /dev/null
+++ b/json-logger/src/main/java/org/mule/extension/jsonlogger/Constants.java
@@ -0,0 +1,20 @@
+package org.mule.extension.jsonlogger;
+
+class Constants {
+ static final String APPLICATION_NAME = "applicationName";
+ static final String APPLICATION_VERSION = "applicationVersion";
+ static final String CONTENT = "content";
+ static final String CORRELATION_ID = "correlationId";
+ static final String ENVIRONMENT = "environment";
+ static final String LOCATION_INFO = "locationInfo";
+ static final String ROOT_CONTAINER = "rootContainer";
+ static final String FILE_NAME = "fileName";
+ static final String LINE_NUMBER = "lineNumber";
+ static final String TIMSTAMP = "timestamp";
+ static final String MESSAGE = "message";
+ static final String PRIORITY = "priority";
+ static final String TRACE_POINT = "tracePoint";
+ static final String ELAPSED = "elapsed";
+ static final String START_TIME = "startTime";
+ static final String END_TIME = "endTime";
+}
diff --git a/json-logger/src/main/java/org/mule/extension/jsonlogger/JsonLoggerExtension.java b/json-logger/src/main/java/org/mule/extension/jsonlogger/JsonLoggerExtension.java
new file mode 100644
index 0000000..d075ff5
--- /dev/null
+++ b/json-logger/src/main/java/org/mule/extension/jsonlogger/JsonLoggerExtension.java
@@ -0,0 +1,13 @@
+package org.mule.extension.jsonlogger;
+
+import org.mule.extension.jsonlogger.config.JsonLoggerConfig;
+import org.mule.runtime.extension.api.annotation.Configurations;
+import org.mule.runtime.extension.api.annotation.Extension;
+import org.mule.runtime.extension.api.annotation.dsl.xml.Xml;
+
+@Xml(prefix = "json-logger")
+@Extension(name = "JSON Logger")
+@Configurations(JsonLoggerConfig.class)
+public class JsonLoggerExtension {
+
+}
diff --git a/json-logger/src/main/java/org/mule/extension/jsonlogger/JsonLoggerOperations.java b/json-logger/src/main/java/org/mule/extension/jsonlogger/JsonLoggerOperations.java
new file mode 100644
index 0000000..90d73b9
--- /dev/null
+++ b/json-logger/src/main/java/org/mule/extension/jsonlogger/JsonLoggerOperations.java
@@ -0,0 +1,237 @@
+package org.mule.extension.jsonlogger;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.mule.extension.jsonlogger.config.JsonLoggerConfig;
+import org.mule.extension.jsonlogger.config.LogProcessor;
+import org.mule.extension.jsonlogger.config.ScopeProcessor;
+import org.mule.runtime.api.component.location.ComponentLocation;
+import org.mule.runtime.api.metadata.DataType;
+import org.mule.runtime.api.metadata.MediaType;
+import org.mule.runtime.api.metadata.TypedValue;
+import org.mule.runtime.api.transformation.TransformationService;
+import org.mule.runtime.extension.api.annotation.Expression;
+import org.mule.runtime.extension.api.annotation.param.Config;
+import org.mule.runtime.extension.api.annotation.param.ParameterGroup;
+import org.mule.runtime.extension.api.runtime.operation.Result;
+import org.mule.runtime.extension.api.runtime.parameter.ParameterResolver;
+import org.mule.runtime.extension.api.runtime.process.CompletionCallback;
+import org.mule.runtime.extension.api.runtime.route.Chain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.time.Instant;
+import java.util.HashMap;
+import java.util.Map;
+
+import static java.time.Duration.between;
+import static org.mule.runtime.api.meta.ExpressionSupport.NOT_SUPPORTED;
+import static org.mule.runtime.api.metadata.DataType.TEXT_STRING;
+
+public class JsonLoggerOperations {
+
+ private final static Logger log = LoggerFactory.getLogger("org.mule.extension.jsonlogger.JsonLogger");
+ private final Result VOID_RESULT = Result.builder().build();
+
+ @Inject
+ private TransformationService transformationService;
+
+ public void logger(@ParameterGroup(name = "Logger")
+ @Expression(value = NOT_SUPPORTED)
+ LogProcessor logProcessor,
+ @Config
+ JsonLoggerConfig config,
+ ComponentLocation location,
+ CompletionCallback callback) {
+
+ String priority = logProcessor.getPriority().toString();
+ if (!isLogEnabled(priority)) {
+ callback.success(VOID_RESULT);
+ return;
+ }
+ ObjectNode logEvent = Mapper.getInstance().createObjectNode();
+
+ logEvent.put(Constants.CORRELATION_ID, logProcessor.getCorrelationId())
+ .put(Constants.MESSAGE, logProcessor.getMessage())
+ .put(Constants.PRIORITY, priority)
+ .put(Constants.TRACE_POINT, logProcessor.getTracePoint().toString());
+
+ addLocationInfo(logEvent, location);
+
+ addAppInfo(logEvent, config);
+
+ addContent(logEvent, logProcessor.getContent(), config);
+
+ log(logEvent, priority, config.isPrettyPrint());
+
+ callback.success(VOID_RESULT);
+ }
+
+ // scope operations cannot receive config at this time
+ public void loggerScope(@ParameterGroup(name = "LoggerScope")
+ @Expression(value = NOT_SUPPORTED)
+ ScopeProcessor scopeProcessor,
+ ComponentLocation location,
+ Chain operations,
+ CompletionCallback