diff --git a/datamover/dist/etc/log.xml b/datamover/dist/etc/log.xml index 312cff0c9b8821ce10b6c73d677fa2bdb8007664..c8169840b4af29e598668b8d51f1635abb12eb51 100644 --- a/datamover/dist/etc/log.xml +++ b/datamover/dist/etc/log.xml @@ -14,7 +14,7 @@ </appender> - <appender name="MANUAL_INTERVENTION" class="org.apache.log4j.DailyRollingFileAppender"> + <appender name="MANUAL_INTERVENTION_APPENDER" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="log/manual_intervention.txt"/> <param name="DatePattern" value="'.'yyyy-MM-dd"/> @@ -58,9 +58,9 @@ <appender-ref ref="EMAIL" /> </category> - <logger name="OPERATION.ch.systemsx.cisd.datamover.GatePathHandlerDecorator"> + <logger name="MANUAL_INTERVENTION"> <level value ="info" /> - <appender-ref ref="MANUAL_INTERVENTION" /> + <appender-ref ref="MANUAL_INTERVENTION_APPENDER" /> </logger> <root> diff --git a/datamover/dist/etc/service.properties b/datamover/dist/etc/service.properties index 1ce6313486c106629e3de30d9094774e5dcb5ede..3742e25dbe26ac6fb6ba344e7c9041cadab95897 100644 --- a/datamover/dist/etc/service.properties +++ b/datamover/dist/etc/service.properties @@ -12,7 +12,6 @@ prefix-for-incoming = %t_ # Optional (remove comments when changing the values) # # rsync-executable = <path to rsync> -# ssh-executable = <path to ssh> # hard-link-executable = <path to ln for creating hard links> # outgoing-host = <host where the outgoing directory is located (specify only when using an ssh tunnel)> # incoming-host = <host where the incoming directory is located (specify only when using an ssh tunnel)> @@ -23,7 +22,7 @@ prefix-for-incoming = %t_ # failure-interval = <time interval to wait after a failure before the operation is re-tried in seconds> # max-retries = <maximal number of retries when an operation fails> # cleansing-regex = <regex of paths that should be removed before moving a path to outgoing> -# manual-intervention-regex = <regex of paths that need manual intervention> +# manual-intervention-regex = <regex of paths that need manual intervention, default prefix-for-incoming corresponds to '[0-9]{14}_'> # treat-incoming-as-remote = <true or false, when switched on, than incoming directory is treated as remote> # extra-copy-dir = <path to a directory. If specified, a copy of incoming data will be made there> # prefix-for-incoming = prefix that is put in front of every incoming data directory, %t will be replaced with time stamp \ No newline at end of file diff --git a/datamover/source/java/ch/systemsx/cisd/datamover/LocalProcessor.java b/datamover/source/java/ch/systemsx/cisd/datamover/LocalProcessor.java index f76858b47caaac59aefadfbd8f923a82c9601820..3f5fe11721377509e9627885c4ab40e35e23b9c7 100644 --- a/datamover/source/java/ch/systemsx/cisd/datamover/LocalProcessor.java +++ b/datamover/source/java/ch/systemsx/cisd/datamover/LocalProcessor.java @@ -46,6 +46,8 @@ public class LocalProcessor implements IPathHandler, IRecoverableTimerTaskFactor { private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, LocalProcessor.class); + private static final Logger manualInterventionLog = Logger.getLogger("MANUAL_INTERVENTION"); + private static final ISimpleLogger errorLog = new Log4jSimpleLogger(Level.ERROR, operationLog); private static final Logger notificationLog = LogFactory.getLogger(LogCategory.NOTIFY, LocalProcessor.class); @@ -260,8 +262,9 @@ public class LocalProcessor implements IPathHandler, IRecoverableTimerTaskFactor manualInterventionFilter.add(PathType.ALL, manualInterventionRegex); } - final boolean filtered = manualInterventionFilter.accept(resource); - if (filtered) + final boolean needsManualIntervention = manualInterventionFilter.accept(resource); + logManualIntervention(resource, needsManualIntervention); + if (needsManualIntervention) { log(resource, "Moving to manual intervention directory"); File movedFile = mover.tryMove(resource, manualInterventionDir); @@ -279,4 +282,14 @@ public class LocalProcessor implements IPathHandler, IRecoverableTimerTaskFactor operationLog.info(String.format("%s on %s", description, path.getPath())); } } + + private static void logManualIntervention(File path, boolean needsManualIntervention) + { + if (manualInterventionLog.isInfoEnabled()) + { + manualInterventionLog.info(String.format("%s %s [created: %3$tY-%3$tm-%3$td %3$tH:%3$tM:%3$tS]", + needsManualIntervention ? "ATTENTION" : "DEFAULT", path.getAbsolutePath(), path.lastModified())); + } + } + }