From bebdec1a9f7b4588efe619a2100ae4824a5e426a Mon Sep 17 00:00:00 2001 From: baubakg Date: Mon, 18 Mar 2024 15:11:19 +0100 Subject: [PATCH] Fixed #83 implemented more careful log handling --- ReleaseNotes.md | 2 + docs/Technical.md | 20 +++++++--- .../service/IntegroBridgeClassLoader.java | 6 +-- .../src/main/resources/log4j2.xml | 25 ++++++++++-- .../src/test/resources/log4j2.xml | 38 ++++++++++++++----- 5 files changed, 69 insertions(+), 22 deletions(-) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 38812894..955c4e2d 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -5,6 +5,8 @@ * [#72 Provide the stack trace of the root cause of the errors](https://github.com/adobe/bridgeService/issues/72). With issue #9 we discovered that the stack trace should be that of the original cause. * [#78 Trimming error messages](https://github.com/adobe/bridgeService/issues/78). We now trim the error messages. * [#80 Removing stack trace for certain errors](https://github.com/adobe/bridgeService/issues/80). We removed the stack trace for errors, where the method or class cannot be found or accessed. +* [#83 Adapting log files for production](https://github.com/adobe/bridgeService/issues/83). We now limit the log files so not too much log data is stored. More details to be found in [the Technical Doc](docs/Technical.md). +* Moved the log level for the loading of the classes to 'trace' instead of 'debug'. * We have now introduced a dedicated exception or when a public Method in a Java class with no scope definition. This created linkage errors. ## 2.11.14 diff --git a/docs/Technical.md b/docs/Technical.md index 8dc9170a..ca6efe86 100644 --- a/docs/Technical.md +++ b/docs/Technical.md @@ -4,11 +4,11 @@ This document deals with the general technical elements of the project. ## Error Handling We currently manage the following error types. -| Error Code | Exceptions | Description | -|------------|------------------------------------------------------------------------------------|------------------------------------------------------------| -| 404 | NonExistentJavaObjectException , JsonProcessingException, AmbiguousMethodException | Errors due to client side manipulations, and payloads. | -| 408 | IBSTimeOutException | When the underlying java call takes too long to execute. | -| 500 | IBSConfigurationException, IBSRunTimeException, TargetJavaMethodCallException | Errors happening when calling the underlying Java classes. | +| Error Code | Exceptions | Description | +|------------|----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------| +| 404 | NonExistentJavaObjectException , JsonProcessingException, AmbiguousMethodException, JavaObjectInaccessibleException | Errors due to client side manipulations, and payloads. | +| 408 | IBSTimeOutException | When the underlying java call takes too long to execute. | +| 500 | IBSConfigurationException, IBSRunTimeException, TargetJavaMethodCallException | Errors happening when calling the underlying Java classes. | ## Managing Contexts and Static Variables We have three modes of Integrity management : @@ -33,4 +33,12 @@ This page describes the state of how Calls access static variables. The structur 1. Environment Variable Setting 2. Calling Java 3. (optional) Environment Variable Setting -4. Calling Java \ No newline at end of file +4. Calling Java + +## Log Handling +The logs are by default deleted after a certain time. In production, we have opted for the following rules: +* They are stored in the directory 'ibs_output' +* When the size becomes larger than 50MB, we archive the contents to a zip file +* The zip files are deleted on a regular basis based on the following rules: + * The files exceed 3GB + * The files are more than 10 days old. diff --git a/integroBridgeService/src/main/java/com/adobe/campaign/tests/bridge/service/IntegroBridgeClassLoader.java b/integroBridgeService/src/main/java/com/adobe/campaign/tests/bridge/service/IntegroBridgeClassLoader.java index e4947a45..f73d8802 100644 --- a/integroBridgeService/src/main/java/com/adobe/campaign/tests/bridge/service/IntegroBridgeClassLoader.java +++ b/integroBridgeService/src/main/java/com/adobe/campaign/tests/bridge/service/IntegroBridgeClassLoader.java @@ -46,10 +46,10 @@ private synchronized Class getClass(String in_classPath) throws ClassNotFoundEx // is this class already loaded? Class cls = super.findLoadedClass(in_classPath); if (cls != null) { - log.debug("Class {} has already been loaded.",in_classPath); + log.trace("Class {} has already been loaded.",in_classPath); return cls; } else { - log.debug("Class {} has not been loaded. Loading now.", in_classPath); + log.trace("Class {} has not been loaded. Loading now.", in_classPath); } @@ -89,7 +89,7 @@ private synchronized Class getClass(String in_classPath) throws ClassNotFoundEx */ @Override public Class loadClass(String in_classFullPath) throws ClassNotFoundException { - log.debug("Preparing class {}", in_classFullPath); + log.trace("Preparing class {}", in_classFullPath); if (ConfigValueHandlerIBS.INTEGRITY_PACKAGE_INJECTION_MODE.is("manual", "semi-manual")) { if (isClassAmongPackagePaths(in_classFullPath)) { diff --git a/integroBridgeService/src/main/resources/log4j2.xml b/integroBridgeService/src/main/resources/log4j2.xml index 1931be23..fcca4557 100644 --- a/integroBridgeService/src/main/resources/log4j2.xml +++ b/integroBridgeService/src/main/resources/log4j2.xml @@ -12,17 +12,36 @@ - - - + + + %-5p | %d{yyyy-MM-dd HH:mm:ss} | [%t] %C{2} (%F:%L) - %m%n + + + + + + + + + + + + + + + + + + diff --git a/integroBridgeService/src/test/resources/log4j2.xml b/integroBridgeService/src/test/resources/log4j2.xml index b52c580b..263ccc16 100644 --- a/integroBridgeService/src/test/resources/log4j2.xml +++ b/integroBridgeService/src/test/resources/log4j2.xml @@ -12,20 +12,38 @@ - - - + + + %-5p | %d{yyyy-MM-dd HH:mm:ss} | [%t] %C{2} (%F:%L) - %m%n + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + \ No newline at end of file