diff --git a/pythonExamples/dataSourceIngestModule.py b/pythonExamples/dataSourceIngestModule.py index 2761acdaec..7d6a535aaa 100755 --- a/pythonExamples/dataSourceIngestModule.py +++ b/pythonExamples/dataSourceIngestModule.py @@ -33,6 +33,7 @@ import jarray from java.lang import System +from java.util.logging import Level from org.sleuthkit.datamodel import SleuthkitCase from org.sleuthkit.datamodel import AbstractFile from org.sleuthkit.datamodel import ReadContentInputStream @@ -113,7 +114,7 @@ class SampleJythonDataSourceIngestModule(DataSourceIngestModule): files = fileManager.findFiles(dataSource, "%test%") numFiles = len(files) - logger.info("found " + str(numFiles) + " files") + logger.logp(Level.INFO, SampleJythonDataSourceIngestModule.__name__, "process", "found " + str(numFiles) + " files") progressBar.switchToDeterminate(numFiles) fileCount = 0; for file in files: @@ -122,7 +123,7 @@ class SampleJythonDataSourceIngestModule(DataSourceIngestModule): if self.context.isJobCancelled(): return IngestModule.ProcessResult.OK - logger.info("Processing file: " + file.getName()) + logger.logp(Level.INFO, SampleJythonDataSourceIngestModule.__name__, "process", "Processing file: " + file.getName()) fileCount += 1 # Make an artifact on the blackboard. TSK_INTERESTING_FILE_HIT is a generic type of diff --git a/pythonExamples/fileIngestModule.py b/pythonExamples/fileIngestModule.py index 399592c2f3..579348ad36 100755 --- a/pythonExamples/fileIngestModule.py +++ b/pythonExamples/fileIngestModule.py @@ -33,6 +33,7 @@ import jarray from java.lang import System +from java.util.logging import Level from org.sleuthkit.datamodel import SleuthkitCase from org.sleuthkit.datamodel import AbstractFile from org.sleuthkit.datamodel import ReadContentInputStream @@ -99,7 +100,7 @@ class SampleJythonFileIngestModule(FileIngestModule): # For an example, we will flag files with .txt in the name and make a blackboard artifact. if file.getName().find(".txt") != -1: - self.logger.info("Found a text file: " + file.getName()) + self.logger.logp(Level.INFO, SampleJythonFileIngestModule.__name__, "process", "Found a text file: " + file.getName()) self.filesFound+=1 # Make an artifact on the blackboard. TSK_INTERESTING_FILE_HIT is a generic type of diff --git a/pythonExamples/fileIngestModuleWithGui.py b/pythonExamples/fileIngestModuleWithGui.py index e1647eacb9..7780dcf3f2 100755 --- a/pythonExamples/fileIngestModuleWithGui.py +++ b/pythonExamples/fileIngestModuleWithGui.py @@ -40,6 +40,7 @@ import jarray from java.lang import System +from java.util.logging import Level from javax.swing import JCheckBox from javax.swing import BoxLayout from org.sleuthkit.autopsy.casemodule import Case @@ -117,12 +118,12 @@ class SampleFileIngestModuleWithUI(FileIngestModule): # TODO: Add any setup code that you need here. def startUp(self, context): self.logger = Logger.getLogger(SampleFileIngestModuleWithUIFactory.moduleName) - + # As an example, determine if user configured a flag in UI if self.local_settings.getFlag(): - self.logger.info("flag is set") + self.logger.logp(Level.INFO, SampleFileIngestModuleWithUI.__name__, "startUp", "flag is set") else: - self.logger.info("flag is not set") + self.logger.logp(Level.INFO, SampleFileIngestModuleWithUI.__name__, "startUp", "flag is not set") # Throw an IngestModule.IngestModuleException exception if there was a problem setting up # raise IngestModuleException(IngestModule(), "Oh No!")