Skip to content
Snippets Groups Projects
Commit 0374df23 authored by brinn's avatar brinn
Browse files

add: new ISimpleLogger that is based on log4j

change: remove log4j dependency from FileUtilities

SVN: 1492
parent f2d25ad1
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,12 @@ package ch.systemsx.cisd.datamover; ...@@ -19,6 +19,12 @@ package ch.systemsx.cisd.datamover;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import ch.systemsx.cisd.common.logging.ISimpleLogger;
import ch.systemsx.cisd.common.logging.Log4jSimpleLogger;
import ch.systemsx.cisd.common.logging.LogCategory;
import ch.systemsx.cisd.common.logging.LogFactory;
import ch.systemsx.cisd.common.utilities.FileUtilities; import ch.systemsx.cisd.common.utilities.FileUtilities;
import ch.systemsx.cisd.common.utilities.DirectoryScanningTimerTask.IPathHandler; import ch.systemsx.cisd.common.utilities.DirectoryScanningTimerTask.IPathHandler;
...@@ -33,6 +39,9 @@ import ch.systemsx.cisd.common.utilities.DirectoryScanningTimerTask.IPathHandler ...@@ -33,6 +39,9 @@ import ch.systemsx.cisd.common.utilities.DirectoryScanningTimerTask.IPathHandler
public class CleansingPathHandlerDecorator implements IPathHandler public class CleansingPathHandlerDecorator implements IPathHandler
{ {
private final Logger operationLog =
LogFactory.getLogger(LogCategory.OPERATION, CleansingPathHandlerDecorator.class);
private final FileFilter filter; private final FileFilter filter;
private final IPathHandler decoratedHandler; private final IPathHandler decoratedHandler;
...@@ -50,7 +59,9 @@ public class CleansingPathHandlerDecorator implements IPathHandler ...@@ -50,7 +59,9 @@ public class CleansingPathHandlerDecorator implements IPathHandler
{ {
assert path != null; assert path != null;
final boolean pathDeleted = FileUtilities.deleteRecursively(path, filter); final ISimpleLogger logger =
operationLog.isDebugEnabled() ? new Log4jSimpleLogger(Level.DEBUG, operationLog) : null;
final boolean pathDeleted = FileUtilities.deleteRecursively(path, filter, logger);
if (pathDeleted == false) if (pathDeleted == false)
{ {
return decoratedHandler.handle(path); return decoratedHandler.handle(path);
...@@ -59,5 +70,4 @@ public class CleansingPathHandlerDecorator implements IPathHandler ...@@ -59,5 +70,4 @@ public class CleansingPathHandlerDecorator implements IPathHandler
return true; return true;
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment