From bea39e2b9fb3f5bd4104176f754bddff3d7a2716 Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Sat, 19 Oct 2024 16:00:35 +0200 Subject: [PATCH] [Minor] Reduce logging statements by using more debug --- .../java/li/strolch/execution/Controller.java | 6 +- .../execution/EventBasedExecutionHandler.java | 19 +- .../strolch/execution/ExecutionHandler.java | 228 ++++++------------ .../command/ArchiveActivityCommand.java | 3 +- .../PlanAndExecuteActivityCommand.java | 2 +- .../execution/policy/ExecutionPolicy.java | 3 +- .../policy/RemoveActivityArchival.java | 3 +- .../execution/policy/SimplePlanning.java | 2 +- .../rest/filters/LogRequestFilter.java | 6 +- 9 files changed, 104 insertions(+), 168 deletions(-) diff --git a/strolch-service/src/main/java/li/strolch/execution/Controller.java b/strolch-service/src/main/java/li/strolch/execution/Controller.java index e5d8fa943..5e07a2e53 100644 --- a/strolch-service/src/main/java/li/strolch/execution/Controller.java +++ b/strolch-service/src/main/java/li/strolch/execution/Controller.java @@ -53,7 +53,7 @@ public Controller(String realm, ExecutionHandler executionHandler, Activity acti this.activityId = activity.getId(); this.activity = activity; this.inExecution = synchronizedMap(new HashMap<>()); - this.lockRetries = executionHandler.getConfiguration().getInt(PROP_LOCK_RETRIES, 2); + this.lockRetries = executionHandler.getLockRetriesCount(); } public String getRealm() { @@ -160,7 +160,7 @@ public boolean execute() throws Exception { // then we trigger execution for the same activity if the controller says it is needed if (trigger) { - logger.info("Triggering additional execution of controller {} after execution.", this); + logger.debug("Triggering additional execution of controller {} after execution.", this); triggerExecute(tx); } @@ -203,7 +203,7 @@ public void execute(StrolchTransaction tx) { protected boolean internalExecute(StrolchTransaction tx) { if (this.activity.getState().isExecuted()) { this.executionHandler.removeFromExecution(this); - logger.info("Archiving executed activity {} with state {}", this.locator, this.activity.getState()); + logger.debug("Archiving executed activity {} with state {}", this.locator, this.activity.getState()); this.executionHandler.archiveActivity(this.realm, this.activity.getLocator()); return false; } diff --git a/strolch-service/src/main/java/li/strolch/execution/EventBasedExecutionHandler.java b/strolch-service/src/main/java/li/strolch/execution/EventBasedExecutionHandler.java index 70b0d8323..6b7f85290 100644 --- a/strolch-service/src/main/java/li/strolch/execution/EventBasedExecutionHandler.java +++ b/strolch-service/src/main/java/li/strolch/execution/EventBasedExecutionHandler.java @@ -36,6 +36,7 @@ */ public class EventBasedExecutionHandler extends ExecutionHandler { + public static final String ADDED_MSG = "Added {} @ {}"; protected final MapOfMaps controllers; protected Map statesByRealm; protected DelayedExecutionTimer delayedExecutionTimer; @@ -211,6 +212,7 @@ public void toExecution(String realm, Activity activity) { Controller controller = this.controllers.getElement(realm, locator); if (controller == null) { controller = newController(realm, activity); + logger.info("Added {} @ {}", locator, realm); this.controllers.addElement(realm, locator, controller); notifyObserverAdd(controller); } @@ -312,6 +314,7 @@ public void reloadActivitiesInExecution(PrivilegeContext ctx, String realmName) // register for execution Controller controller = newController(realmName, activity); + logger.info(ADDED_MSG, locator, realmName); this.controllers.addElement(realmName, locator, controller); }); @@ -341,7 +344,7 @@ public void triggerExecution(String realm) { return; } - logger.info("Triggering execution for all controllers on realm {}...", realm); + logger.debug("Triggering execution for all controllers on realm {}...", realm); getExecutor().execute(() -> { synchronized (this.controllers) { controllerStream(realm).forEach(this::toExecution); @@ -358,7 +361,7 @@ protected void toExecution(Controller controller) { return; } - logger.info("Added toExecution task for {} @ {}", controller.getLocator(), realm); + logger.debug("Added toExecution task for {} @ {}", controller.getLocator(), realm); getExecutor().execute(() -> { try { @@ -366,7 +369,7 @@ protected void toExecution(Controller controller) { boolean trigger = controller.execute(); if (trigger) { - logger.info("Triggering of controllers for realm {} after executing {}", realm, controller); + logger.debug("Triggering of controllers for realm {} after executing {}", realm, controller); triggerExecution(realm); } @@ -390,7 +393,7 @@ public void toExecuted(Locator actionLoc) { @Override public void toExecuted(String realm, Locator locator) { - logger.info("Added toExecuted task for {} @ {}", locator, realm); + logger.debug("Added toExecuted task for {} @ {}", locator, realm); getExecutor().execute(() -> { try { @@ -420,7 +423,7 @@ public void toStopped(Locator actionLoc) { @Override public void toStopped(String realm, Locator locator) { - logger.warn("Added toStopped task for {} @ {}", locator, realm); + logger.debug("Added toStopped task for {} @ {}", locator, realm); getExecutor().execute(() -> { try { @@ -448,7 +451,7 @@ public void toError(Locator actionLoc) { @Override public void toError(String realm, Locator locator) { - logger.error("Added toError task for {} @ {}", locator, realm); + logger.debug("Added toError task for {} @ {}", locator, realm); getExecutor().execute(() -> { try { @@ -476,7 +479,7 @@ public void toWarning(Locator actionLoc) { @Override public void toWarning(String realm, Locator locator) { - logger.warn("Added toWarning task for {} @ {}", locator, realm); + logger.debug("Added toWarning task for {} @ {}", locator, realm); getExecutor().execute(() -> { try { @@ -504,7 +507,7 @@ public void archiveActivity(Locator activityLoc) { @Override public void archiveActivity(String realm, Locator activityLoc) { - logger.info("Added archiveActivity task for {} @ {}", activityLoc, realm); + logger.debug("Added archiveActivity task for {} @ {}", activityLoc, realm); Locator trimmedLocator = trimLocator(activityLoc); getExecutor().execute(() -> { try { diff --git a/strolch-service/src/main/java/li/strolch/execution/ExecutionHandler.java b/strolch-service/src/main/java/li/strolch/execution/ExecutionHandler.java index 97bbe1d7e..c308cd18c 100644 --- a/strolch-service/src/main/java/li/strolch/execution/ExecutionHandler.java +++ b/strolch-service/src/main/java/li/strolch/execution/ExecutionHandler.java @@ -48,6 +48,7 @@ public abstract class ExecutionHandler extends StrolchComponent { public static final String PARAM_STATE = "state"; private String defaultRealm; + private int lockRetriesCount; public ExecutionHandler(ComponentContainer container, String componentName) { super(container, componentName); @@ -58,9 +59,14 @@ public void initialize(ComponentConfiguration configuration) throws Exception { Set realmNames = getAgent().getContainer().getRealmNames(); if (realmNames.size() == 1) this.defaultRealm = realmNames.iterator().next(); + this.lockRetriesCount = configuration.getInt(PROP_LOCK_RETRIES, 2); super.initialize(configuration); } + public int getLockRetriesCount() { + return this.lockRetriesCount; + } + protected String getDefaultRealm() { if (StringHelper.isEmpty(this.defaultRealm)) throw new IllegalStateException("No default realm defined!"); @@ -89,51 +95,42 @@ public ExecutorService getExecutor() { /** * Returns true if the given {@link Activity} is currently being controlled on the default realm * - * @param activity - * the activity to check if it is being controlled + * @param activity the activity to check if it is being controlled * * @return true or false * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract boolean isControlling(Activity activity); /** * Returns true if the given {@link Activity} is currently being controlled on the given realm * - * @param realm - * the realm - * @param activity - * the activity to check if it is being controlled + * @param realm the realm + * @param activity the activity to check if it is being controlled * * @return true or false * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract boolean isControlling(String realm, Activity activity); /** * Returns true if the given {@link Activity} is currently being controlled on the default realm * - * @param locator - * the locator of the activity to check if it is being controlled + * @param locator the locator of the activity to check if it is being controlled * * @return true or false * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract boolean isControlling(Locator locator); /** * Returns true if the given {@link Activity} is currently being controlled on the given realm * - * @param realm - * the realm - * @param locator - * the locator of the activity to check if it is being controlled + * @param realm the realm + * @param locator the locator of the activity to check if it is being controlled * * @return true or false */ @@ -144,16 +141,14 @@ public ExecutorService getExecutor() { * * @return the controllers * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract List getControllers(); /** * Returns the controllers for the given realm * - * @param realm - * the realm for which to get the controller + * @param realm the realm for which to get the controller * * @return the controllers */ @@ -162,23 +157,19 @@ public ExecutorService getExecutor() { /** * Returns the controller for the default realm and activity, null if it does not exist * - * @param activity - * the activity for which to get the controller + * @param activity the activity for which to get the controller * * @return the controller, or null if it does not exist * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract Controller getController(Activity activity); /** * Returns the controller for the given realm and activity, null if it does not exist * - * @param realm - * the realm for which to get the controller - * @param activity - * the activity for which to get the controller + * @param realm the realm for which to get the controller + * @param activity the activity for which to get the controller * * @return the controller, or null if it does not exist */ @@ -187,23 +178,19 @@ public ExecutorService getExecutor() { /** * Returns the controller for the default realm and activity, null if it does not exist * - * @param locator - * the locator of the activity for which to get the controller + * @param locator the locator of the activity for which to get the controller * * @return the controller, or null if it does not exist * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract Controller getController(Locator locator); /** * Returns the controller for the given realm and activity, null if it does not exist * - * @param realm - * the realm for which to get the controller - * @param locator - * the locator of the activity for which to get the controller + * @param realm the realm for which to get the controller + * @param locator the locator of the activity for which to get the controller * * @return the controller, or null if it does not exist */ @@ -213,11 +200,9 @@ public ExecutorService getExecutor() { * Registers the given {@link Activity} for execution on the default realm. Execution is started when the concrete * implementation deems necessary * - * @param activity - * the {@link Activity} + * @param activity the {@link Activity} * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract Controller addForExecution(Activity activity); @@ -225,10 +210,8 @@ public ExecutorService getExecutor() { * Registers the given {@link Activity} for execution. Execution is started when the concrete implementation deems * necessary * - * @param realm - * the realm where the {@link Activity} resides - * @param activity - * the {@link Activity} + * @param realm the realm where the {@link Activity} resides + * @param activity the {@link Activity} */ public abstract Controller addForExecution(String realm, Activity activity); @@ -236,11 +219,9 @@ public ExecutorService getExecutor() { * Registers the given {@link Activity} for execution on the default realm, and submits it for execution immediately * in an asynchronous manner * - * @param activity - * the {@link Activity} + * @param activity the {@link Activity} * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract void toExecution(Activity activity); @@ -248,10 +229,8 @@ public ExecutorService getExecutor() { * Registers the given {@link Activity} for execution, and submits it for execution immediately in an asynchronous * manner * - * @param realm - * the realm where the {@link Activity} resides - * @param activity - * the {@link Activity} + * @param realm the realm where the {@link Activity} resides + * @param activity the {@link Activity} */ public abstract void toExecution(String realm, Activity activity); @@ -259,11 +238,9 @@ public ExecutorService getExecutor() { * Triggers the execution of the given {@link Activity}'s {@link Locator} on the default realm. If the * {@link Controller} is available, then it is triggered * - * @param activityLoc - * the {@link Locator} for the activity to execute + * @param activityLoc the {@link Locator} for the activity to execute * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract void toExecution(Locator activityLoc); @@ -271,18 +248,15 @@ public ExecutorService getExecutor() { * Triggers the execution of the given {@link Activity}'s {@link Locator}. If the {@link Controller} is available, * then it is triggered * - * @param realm - * the realm where the {@link Activity} resides - * @param activityLoc - * the {@link Locator} for the activity to execute + * @param realm the realm where the {@link Activity} resides + * @param activityLoc the {@link Locator} for the activity to execute */ public abstract void toExecution(String realm, Locator activityLoc); /** * Removes the given {@link Controller} from execution, so it is not executed further * - * @param controller - * the controller to remove + * @param controller the controller to remove */ public abstract void removeFromExecution(Controller controller); @@ -290,21 +264,17 @@ public ExecutorService getExecutor() { * Removes the given {@link Locator} for an {@link Activity} from execution from the default realm, so it is not * executed further * - * @param activityLoc - * the {@link Locator} of the {@link Activity} + * @param activityLoc the {@link Locator} of the {@link Activity} * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract void removeFromExecution(Locator activityLoc); /** * Removes the given {@link Locator} for an {@link Activity} from execution, so it is not executed further * - * @param realm - * the realm where the {@link Activity} resides - * @param activityLoc - * the {@link Locator} of the {@link Activity} + * @param realm the realm where the {@link Activity} resides + * @param activityLoc the {@link Locator} of the {@link Activity} */ public abstract void removeFromExecution(String realm, Locator activityLoc); @@ -312,53 +282,45 @@ public ExecutorService getExecutor() { * Restarts all existing Activities on the given realm, which are not yet executed and already in state of * execution * - * @param ctx - * the privilege context + * @param ctx the privilege context * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract void reloadActivitiesInExecution(PrivilegeContext ctx); /** * Restarts all existing Activities which are not yet executed and already in state of execution * - * @param ctx - * the privilege context - * @param realm - * the realm for which to restart activities + * @param ctx the privilege context + * @param realm the realm for which to restart activities */ public abstract void reloadActivitiesInExecution(PrivilegeContext ctx, String realm); /** * Removes all currently registered {@link Activity Activities} from execution from the default realm * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract void clearAllCurrentExecutions(); /** * Removes all currently registered {@link Activity Activities} from execution * - * @param realm - * the realm for which to restart activities + * @param realm the realm for which to restart activities */ public abstract void clearAllCurrentExecutions(String realm); /** * Triggers execution for all registered activities in the default realm * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract void triggerExecution(); /** * Triggers execution for all registered activities in the given realm * - * @param realm - * the realm to trigger execution for + * @param realm the realm to trigger execution for */ public abstract void triggerExecution(String realm); @@ -367,16 +329,14 @@ public ExecutorService getExecutor() { * * @return the state of the execution handler * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract ExecutionHandlerState getExecutionState(); /** * Get the state of the execution handler for the given realm * - * @param realm - * the realm for which to get the state + * @param realm the realm for which to get the state * * @return the state of the execution handler */ @@ -385,46 +345,36 @@ public ExecutorService getExecutor() { /** * Set the state for the default realm * - * @param cert - * certificate to use - * @param state - * the state to set + * @param cert certificate to use + * @param state the state to set * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract void getExecutionState(Certificate cert, ExecutionHandlerState state); /** * Set the state for the given realm * - * @param cert - * certificate to use - * @param realm - * the realm to halt execution for - * @param state - * the state to set + * @param cert certificate to use + * @param realm the realm to halt execution for + * @param state the state to set */ public abstract void getExecutionState(Certificate cert, String realm, ExecutionHandlerState state); /** * Archives the given {@link Activity} on the default realm * - * @param activityLoc - * the {@link Locator} of the {@link Activity} to archive + * @param activityLoc the {@link Locator} of the {@link Activity} to archive * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract void archiveActivity(Locator activityLoc); /** * Archives the given {@link Activity} * - * @param realm - * the realm where the activity resides - * @param activityLoc - * the {@link Locator} of the {@link Activity} to archive + * @param realm the realm where the activity resides + * @param activityLoc the {@link Locator} of the {@link Activity} to archive */ public abstract void archiveActivity(String realm, Locator activityLoc); @@ -434,8 +384,7 @@ public ExecutorService getExecutor() { * * @return a set of locators * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract Set getActiveActivitiesLocator(); @@ -443,8 +392,7 @@ public ExecutorService getExecutor() { * Returns the {@link Set} of {@link Locator Locators} of {@link Activity Activities} which are registered for * execution for the given realm * - * @param realm - * the realm for which to return the registered activities + * @param realm the realm for which to return the registered activities * * @return a set of locators */ @@ -467,21 +415,17 @@ public ExecutorService getExecutor() { /** * Completes the execution of the given {@link Action} with the given {@link Locator} on the default realm * - * @param actionLoc - * the {@link Locator} of the {@link Action} + * @param actionLoc the {@link Locator} of the {@link Action} * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract void toExecuted(Locator actionLoc); /** * Completes the execution of the given {@link Action} with the given {@link Locator} * - * @param realm - * the realm where the {@link Action} resides - * @param actionLoc - * the {@link Locator} of the {@link Action} + * @param realm the realm where the {@link Action} resides + * @param actionLoc the {@link Locator} of the {@link Action} */ public abstract void toExecuted(String realm, Locator actionLoc); @@ -489,21 +433,17 @@ public ExecutorService getExecutor() { * Sets the state of the {@link Action} with the given {@link Locator} to {@link State#STOPPED} on the default * realm * - * @param actionLoc - * the {@link Locator} of the {@link Action} + * @param actionLoc the {@link Locator} of the {@link Action} * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract void toStopped(Locator actionLoc); /** * Sets the state of the {@link Action} with the given {@link Locator} to {@link State#STOPPED} * - * @param realm - * the realm where the {@link Action} resides - * @param actionLoc - * the {@link Locator} of the {@link Action} + * @param realm the realm where the {@link Action} resides + * @param actionLoc the {@link Locator} of the {@link Action} */ public abstract void toStopped(String realm, Locator actionLoc); @@ -511,42 +451,34 @@ public ExecutorService getExecutor() { * Sets the state of the {@link Action} with the given {@link Locator} to {@link State#WARNING} on the default * realm * - * @param actionLoc - * the {@link Locator} of the {@link Action} + * @param actionLoc the {@link Locator} of the {@link Action} * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract void toWarning(Locator actionLoc); /** * Sets the state of the {@link Action} with the given {@link Locator} to {@link State#WARNING} * - * @param realm - * the realm where the {@link Action} resides - * @param actionLoc - * the {@link Locator} of the {@link Action} + * @param realm the realm where the {@link Action} resides + * @param actionLoc the {@link Locator} of the {@link Action} */ public abstract void toWarning(String realm, Locator actionLoc); /** * Sets the state of the {@link Action} with the given {@link Locator} to {@link State#ERROR} on the default realm * - * @param actionLoc - * the {@link Locator} of the {@link Action} + * @param actionLoc the {@link Locator} of the {@link Action} * - * @throws IllegalStateException - * if the default realm is not set! + * @throws IllegalStateException if the default realm is not set! */ public abstract void toError(Locator actionLoc); /** * Sets the state of the {@link Action} with the given {@link Locator} to {@link State#ERROR} * - * @param realm - * the realm where the {@link Action} resides - * @param actionLoc - * the {@link Locator} of the {@link Action} + * @param realm the realm where the {@link Action} resides + * @param actionLoc the {@link Locator} of the {@link Action} */ public abstract void toError(String realm, Locator actionLoc); diff --git a/strolch-service/src/main/java/li/strolch/execution/command/ArchiveActivityCommand.java b/strolch-service/src/main/java/li/strolch/execution/command/ArchiveActivityCommand.java index 9808df4dd..9161ea478 100644 --- a/strolch-service/src/main/java/li/strolch/execution/command/ArchiveActivityCommand.java +++ b/strolch-service/src/main/java/li/strolch/execution/command/ArchiveActivityCommand.java @@ -34,8 +34,7 @@ public void doCommand() { return; } - logger.info("Activity {} is in state {}", activity.getLocator(), activity.getState()); - + logger.debug("Archiving activity {}", activity.getLocator()); tx().getPolicy(activity, ActivityArchivalPolicy.class).archive(activity); } } diff --git a/strolch-service/src/main/java/li/strolch/execution/command/PlanAndExecuteActivityCommand.java b/strolch-service/src/main/java/li/strolch/execution/command/PlanAndExecuteActivityCommand.java index f2bcaaf40..b0b3edf94 100644 --- a/strolch-service/src/main/java/li/strolch/execution/command/PlanAndExecuteActivityCommand.java +++ b/strolch-service/src/main/java/li/strolch/execution/command/PlanAndExecuteActivityCommand.java @@ -102,7 +102,7 @@ private void executeAction(Action action) { return; } - logger.info("Action {} is now being executed...", action.getLocator()); + logger.debug("Action {} is now being executed...", action.getLocator()); executionPolicy.toExecution(action); confirmationPolicy.doConfirmation(action); diff --git a/strolch-service/src/main/java/li/strolch/execution/policy/ExecutionPolicy.java b/strolch-service/src/main/java/li/strolch/execution/policy/ExecutionPolicy.java index 776273ee4..22303b058 100644 --- a/strolch-service/src/main/java/li/strolch/execution/policy/ExecutionPolicy.java +++ b/strolch-service/src/main/java/li/strolch/execution/policy/ExecutionPolicy.java @@ -431,7 +431,8 @@ protected void delayToExecutedByRandom(long min, long max, TimeUnit delayUnit) { */ protected void delayToExecutedBy(long delay, TimeUnit delayUnit) { long delayMs = delayUnit.toMillis(delay); - logger.info("Delaying toExecuted of {} by {}", this.actionLoc, formatMillisecondsDuration(delayMs)); + if (logger.isTraceEnabled()) + logger.debug("Delaying toExecuted of {} by {}", this.actionLoc, formatMillisecondsDuration(delayMs)); getDelayedExecutionTimer().execute(this.realm, getContainer(), this.actionLoc, delayMs); } diff --git a/strolch-service/src/main/java/li/strolch/execution/policy/RemoveActivityArchival.java b/strolch-service/src/main/java/li/strolch/execution/policy/RemoveActivityArchival.java index 34b3fcb4e..2c1e3b808 100644 --- a/strolch-service/src/main/java/li/strolch/execution/policy/RemoveActivityArchival.java +++ b/strolch-service/src/main/java/li/strolch/execution/policy/RemoveActivityArchival.java @@ -16,7 +16,6 @@ public void archive(Activity activity) { throw new IllegalStateException("Can not archive non-executed " + activity.getLocator()); tx().remove(activity); - - logger.info("Removing {}", activity.getLocator()); + logger.info("Removed {}", activity.getLocator()); } } diff --git a/strolch-service/src/main/java/li/strolch/execution/policy/SimplePlanning.java b/strolch-service/src/main/java/li/strolch/execution/policy/SimplePlanning.java index c5d8bccbb..bfacb3538 100644 --- a/strolch-service/src/main/java/li/strolch/execution/policy/SimplePlanning.java +++ b/strolch-service/src/main/java/li/strolch/execution/policy/SimplePlanning.java @@ -34,7 +34,7 @@ public void plan(Action action) { if (action.getState().compareTo(State.PLANNED) >= 0) throw new IllegalStateException("Can not plan illegal state " + action.getState()); - logger.info("Planning action {}", action.getLocator()); + logger.debug("Planning action {}", action.getLocator()); action.setState(State.PLANNING); Resource resource = evaluateAndSetResource(action); diff --git a/strolch-web-rest/src/main/java/li/strolch/rest/filters/LogRequestFilter.java b/strolch-web-rest/src/main/java/li/strolch/rest/filters/LogRequestFilter.java index 808ac2e4e..935542a09 100644 --- a/strolch-web-rest/src/main/java/li/strolch/rest/filters/LogRequestFilter.java +++ b/strolch-web-rest/src/main/java/li/strolch/rest/filters/LogRequestFilter.java @@ -5,6 +5,7 @@ import jakarta.ws.rs.container.ContainerRequestFilter; import jakarta.ws.rs.container.PreMatching; import jakarta.ws.rs.core.Context; +import li.strolch.rest.RestfulStrolchComponent; import li.strolch.rest.helper.RestfulHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,8 +27,9 @@ public class LogRequestFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { String remoteIp = RestfulHelper.getRemoteIp(this.request); - logger.info("Remote IP: {}: {} {}", remoteIp, requestContext.getMethod(), - requestContext.getUriInfo().getRequestUri()); + if (RestfulStrolchComponent.getInstance().isRestLogging()) + logger.info("Remote IP: {}: {} {}", remoteIp, requestContext.getMethod(), + requestContext.getUriInfo().getRequestUri()); this.request.setAttribute(STROLCH_REMOTE_IP, remoteIp); this.request.setAttribute(STROLCH_REQUEST_URL,