Switched from Java logger to Autopsy logger.

This commit is contained in:
U-BASIS\dgrove 2018-04-06 09:38:06 -04:00
parent 3c652a20f3
commit 37ed49b1b3
17 changed files with 186 additions and 182 deletions

View File

@ -25,12 +25,11 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.table.AbstractTableModel; import javax.swing.table.AbstractTableModel;
import org.openide.util.NbBundle.Messages; import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.datamodel.IngestJobInfo; import org.sleuthkit.datamodel.IngestJobInfo;
import org.sleuthkit.datamodel.IngestModuleInfo; import org.sleuthkit.datamodel.IngestModuleInfo;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2017-18 Basis Technology Corp. * Copyright 2017-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -21,9 +21,9 @@ package org.sleuthkit.autopsy.communications;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.nodes.ChildFactory; import org.openide.nodes.ChildFactory;
import org.openide.nodes.Node; import org.openide.nodes.Node;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.Account; import org.sleuthkit.datamodel.Account;
import org.sleuthkit.datamodel.AccountDeviceInstance; import org.sleuthkit.datamodel.AccountDeviceInstance;
import org.sleuthkit.datamodel.CommunicationsFilter; import org.sleuthkit.datamodel.CommunicationsFilter;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2017 Basis Technology Corp. * Copyright 2011-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -25,8 +25,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.concurrent.GuardedBy; import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe; import javax.annotation.concurrent.ThreadSafe;
import org.apache.curator.RetryPolicy; import org.apache.curator.RetryPolicy;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2017 Basis Technology Corp. * Copyright 2011-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -25,12 +25,12 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.Optional; import java.util.Optional;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.concurrent.GuardedBy; import javax.annotation.concurrent.GuardedBy;
import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord; import org.apache.commons.csv.CSVRecord;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.datamodel.accounts.BINRange; import org.sleuthkit.autopsy.datamodel.accounts.BINRange;
@ -108,7 +108,7 @@ public class CreditCards {
Optional<String> getScheme(); Optional<String> getScheme();
} }
private static final Logger LOGGER = Logger.getLogger(CreditCards.class.getName()); private static final Logger logger = Logger.getLogger(CreditCards.class.getName());
/** /**
@ -166,12 +166,12 @@ public class CreditCards {
binRanges.put(Range.closed(binRange.getBINstart(), binRange.getBINend()), binRange); binRanges.put(Range.closed(binRange.getBINstart(), binRange.getBINend()), binRange);
} catch (NumberFormatException numberFormatException) { } catch (NumberFormatException numberFormatException) {
LOGGER.log(Level.WARNING, "Failed to parse BIN range: " + record.toString(), numberFormatException); //NON-NLS logger.log(Level.WARNING, "Failed to parse BIN range: " + record.toString(), numberFormatException); //NON-NLS
} }
binsLoaded = true; binsLoaded = true;
} }
} catch (IOException ex) { } catch (IOException ex) {
LOGGER.log(Level.WARNING, "Failed to load BIN ranges form ranges.csv", ex); //NON-NLS logger.log(Level.WARNING, "Failed to load BIN ranges form ranges.csv", ex); //NON-NLS
MessageNotifyUtil.Notify.warn("Credit Card Number Discovery", "There was an error loading Bank Identification Number information. Accounts will not have their BINs identified."); MessageNotifyUtil.Notify.warn("Credit Card Number Discovery", "There was an error loading Bank Identification Number information. Accounts will not have their BINs identified.");
} }
} }

View File

@ -40,7 +40,6 @@ import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@ -60,6 +59,7 @@ import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.AutopsyItemVisitor; import org.sleuthkit.autopsy.datamodel.AutopsyItemVisitor;
import org.sleuthkit.autopsy.datamodel.AutopsyVisitableItem; import org.sleuthkit.autopsy.datamodel.AutopsyVisitableItem;
import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2017 Basis Technology Corp. * Copyright 2017-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -18,17 +18,15 @@
*/ */
package org.sleuthkit.autopsy.directorytree; package org.sleuthkit.autopsy.directorytree;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JFrame; import javax.swing.JFrame;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.Volume; import org.sleuthkit.datamodel.Volume;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2017 Basis Technology Corp. * Copyright 2011-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -20,7 +20,7 @@ package org.sleuthkit.autopsy.directorytree;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.FileSystem; import org.sleuthkit.datamodel.FileSystem;
import org.sleuthkit.datamodel.Volume; import org.sleuthkit.datamodel.Volume;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;

View File

@ -20,10 +20,10 @@ package org.sleuthkit.autopsy.directorytree;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;

View File

@ -27,7 +27,6 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultComboBoxModel;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
@ -45,6 +44,7 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel; import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.modules.interestingitems.FilesSet; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet;
import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel; import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel;
import org.sleuthkit.autopsy.modules.interestingitems.FilesSetPanel; import org.sleuthkit.autopsy.modules.interestingitems.FilesSetPanel;

View File

@ -46,7 +46,7 @@ public final class IngestMonitor {
public static final int DISK_FREE_SPACE_UNKNOWN = -1; public static final int DISK_FREE_SPACE_UNKNOWN = -1;
private static final int INITIAL_INTERVAL_MS = 60000; //1 min. private static final int INITIAL_INTERVAL_MS = 60000; //1 min.
private static final int MAX_LOG_FILES = 3; private static final int MAX_LOG_FILES = 3;
private static final java.util.logging.Logger MONITOR_LOGGER = java.util.logging.Logger.getLogger("monitor"); //NON-NLS private static final java.util.logging.Logger monitorLogger = java.util.logging.Logger.getLogger("monitor"); //NON-NLS
private final Logger logger = Logger.getLogger(IngestMonitor.class.getName()); private final Logger logger = Logger.getLogger(IngestMonitor.class.getName());
private Timer timer; private Timer timer;
private MonitorTimerAction timerAction; private MonitorTimerAction timerAction;
@ -63,8 +63,8 @@ public final class IngestMonitor {
FileHandler monitorLogHandler = new FileHandler(PlatformUtil.getUserDirectory().getAbsolutePath() + "/var/log/monitor.log", 0, MAX_LOG_FILES); //NON-NLS FileHandler monitorLogHandler = new FileHandler(PlatformUtil.getUserDirectory().getAbsolutePath() + "/var/log/monitor.log", 0, MAX_LOG_FILES); //NON-NLS
monitorLogHandler.setFormatter(new SimpleFormatter()); monitorLogHandler.setFormatter(new SimpleFormatter());
monitorLogHandler.setEncoding(PlatformUtil.getLogFileEncoding()); monitorLogHandler.setEncoding(PlatformUtil.getLogFileEncoding());
MONITOR_LOGGER.setUseParentHandlers(false); monitorLogger.setUseParentHandlers(false);
MONITOR_LOGGER.addHandler(monitorLogHandler); monitorLogger.addHandler(monitorLogHandler);
} catch (IOException | SecurityException ex) { } catch (IOException | SecurityException ex) {
logger.log(Level.SEVERE, "Failed to create memory usage logger", ex); //NON-NLS logger.log(Level.SEVERE, "Failed to create memory usage logger", ex); //NON-NLS
} }
@ -202,7 +202,7 @@ public final class IngestMonitor {
IngestServices.getInstance().postMessage(IngestMessage.createManagerErrorMessage( IngestServices.getInstance().postMessage(IngestMessage.createManagerErrorMessage(
NbBundle.getMessage(this.getClass(), "IngestMonitor.mgrErrMsg.lowDiskSpace.title", diskPath), NbBundle.getMessage(this.getClass(), "IngestMonitor.mgrErrMsg.lowDiskSpace.title", diskPath),
NbBundle.getMessage(this.getClass(), "IngestMonitor.mgrErrMsg.lowDiskSpace.msg", diskPath))); NbBundle.getMessage(this.getClass(), "IngestMonitor.mgrErrMsg.lowDiskSpace.msg", diskPath)));
MONITOR_LOGGER.log(Level.SEVERE, "Stopping ingest due to low disk space on {0}", diskPath); //NON-NLS monitorLogger.log(Level.SEVERE, "Stopping ingest due to low disk space on {0}", diskPath); //NON-NLS
logger.log(Level.SEVERE, "Stopping ingest due to low disk space on {0}", diskPath); //NON-NLS logger.log(Level.SEVERE, "Stopping ingest due to low disk space on {0}", diskPath); //NON-NLS
} }
} }
@ -211,7 +211,7 @@ public final class IngestMonitor {
* Writes current message usage to the memory usage log. * Writes current message usage to the memory usage log.
*/ */
private void logMemoryUsage() { private void logMemoryUsage() {
MONITOR_LOGGER.log(Level.INFO, PlatformUtil.getAllMemUsageInfo()); monitorLogger.log(Level.INFO, PlatformUtil.getAllMemUsageInfo());
} }
/** /**

View File

@ -43,7 +43,6 @@ import java.io.File;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTable; import javax.swing.JTable;
@ -60,6 +59,7 @@ import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages; import org.openide.util.NbBundle.Messages;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.core.ServicesMonitor; import org.sleuthkit.autopsy.core.ServicesMonitor;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.NetworkUtils; import org.sleuthkit.autopsy.coreutils.NetworkUtils;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@ -141,7 +141,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
private static final int COMPLETED_TIME_COL_PREFERRED_WIDTH = 280; private static final int COMPLETED_TIME_COL_PREFERRED_WIDTH = 280;
private static final String UPDATE_TASKS_THREAD_NAME = "AID-update-tasks-%d"; private static final String UPDATE_TASKS_THREAD_NAME = "AID-update-tasks-%d";
private static final String LOCAL_HOST_NAME = NetworkUtils.getLocalHostName(); private static final String LOCAL_HOST_NAME = NetworkUtils.getLocalHostName();
private static final Logger SYS_LOGGER = AutoIngestSystemLogger.getLogger(); private static final Logger sysLogger = AutoIngestSystemLogger.getLogger();
private static AutoIngestControlPanel instance; private static AutoIngestControlPanel instance;
private final DefaultTableModel pendingTableModel; private final DefaultTableModel pendingTableModel;
private final DefaultTableModel runningTableModel; private final DefaultTableModel runningTableModel;
@ -333,7 +333,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
serviceStatus = NbBundle.getMessage(AutoIngestControlPanel.class, "AutoIngestControlPanel.tbServicesStatusMessage.Message.Down"); serviceStatus = NbBundle.getMessage(AutoIngestControlPanel.class, "AutoIngestControlPanel.tbServicesStatusMessage.Message.Down");
} }
} catch (ServicesMonitor.ServicesMonitorException ex) { } catch (ServicesMonitor.ServicesMonitorException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Dashboard error getting service status for %s", service), ex); sysLogger.log(Level.SEVERE, String.format("Dashboard error getting service status for %s", service), ex);
} }
return serviceStatus; return serviceStatus;
} }
@ -687,7 +687,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
manager.startUp(); manager.startUp();
autoIngestStarted = true; autoIngestStarted = true;
} catch (AutoIngestManager.AutoIngestManagerException ex) { } catch (AutoIngestManager.AutoIngestManagerException ex) {
SYS_LOGGER.log(Level.SEVERE, "Dashboard error starting up auto ingest", ex); sysLogger.log(Level.SEVERE, "Dashboard error starting up auto ingest", ex);
tbStatusMessage.setText(NbBundle.getMessage(AutoIngestControlPanel.class, "AutoIngestControlPanel.AutoIngestStartupError")); tbStatusMessage.setText(NbBundle.getMessage(AutoIngestControlPanel.class, "AutoIngestControlPanel.AutoIngestStartupError"));
manager = null; manager = null;
@ -712,7 +712,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
status = NbBundle.getMessage(AutoIngestControlPanel.class, "AutoIngestControlPanel.tbServicesStatusMessage.Message.Up"); status = NbBundle.getMessage(AutoIngestControlPanel.class, "AutoIngestControlPanel.tbServicesStatusMessage.Message.Up");
} else if (status.equals(ServicesMonitor.ServiceStatus.DOWN.toString())) { } else if (status.equals(ServicesMonitor.ServiceStatus.DOWN.toString())) {
status = NbBundle.getMessage(AutoIngestControlPanel.class, "AutoIngestControlPanel.tbServicesStatusMessage.Message.Down"); status = NbBundle.getMessage(AutoIngestControlPanel.class, "AutoIngestControlPanel.tbServicesStatusMessage.Message.Down");
SYS_LOGGER.log(Level.SEVERE, "Connection to {0} is down", serviceDisplayName); //NON-NLS sysLogger.log(Level.SEVERE, "Connection to {0} is down", serviceDisplayName); //NON-NLS
} }
// if the status update is for an existing service who's status hasn't changed - do nothing. // if the status update is for an existing service who's status hasn't changed - do nothing.
@ -1187,7 +1187,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
job.getPriority()}); // PRIORITY job.getPriority()}); // PRIORITY
} }
} catch (Exception ex) { } catch (Exception ex) {
SYS_LOGGER.log(Level.SEVERE, "Dashboard error refreshing table", ex); sysLogger.log(Level.SEVERE, "Dashboard error refreshing table", ex);
} }
} }
@ -1823,7 +1823,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
try { try {
manager.prioritizeCase(caseName); manager.prioritizeCase(caseName);
} catch (AutoIngestManager.AutoIngestManagerException ex) { } catch (AutoIngestManager.AutoIngestManagerException ex) {
SYS_LOGGER.log(Level.SEVERE, "Error prioritizing a case", ex); sysLogger.log(Level.SEVERE, "Error prioritizing a case", ex);
MessageNotifyUtil.Message.error(Bundle.AutoIngestControlPanel_errorMessage_casePrioritization()); MessageNotifyUtil.Message.error(Bundle.AutoIngestControlPanel_errorMessage_casePrioritization());
} }
refreshTables(); refreshTables();
@ -1862,7 +1862,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
} }
} }
} catch (IOException ex) { } catch (IOException ex) {
SYS_LOGGER.log(Level.SEVERE, "Dashboard error attempting to display case auto ingest log", ex); sysLogger.log(Level.SEVERE, "Dashboard error attempting to display case auto ingest log", ex);
Object[] options = {org.openide.util.NbBundle.getMessage(AutoIngestControlPanel.class, "DisplayLogDialog.okay")}; Object[] options = {org.openide.util.NbBundle.getMessage(AutoIngestControlPanel.class, "DisplayLogDialog.okay")};
JOptionPane.showOptionDialog(this, JOptionPane.showOptionDialog(this,
org.openide.util.NbBundle.getMessage(AutoIngestControlPanel.class, "DisplayLogDialog.cannotFindLog"), org.openide.util.NbBundle.getMessage(AutoIngestControlPanel.class, "DisplayLogDialog.cannotFindLog"),
@ -1883,7 +1883,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
try { try {
manager.prioritizeJob(manifestFilePath); manager.prioritizeJob(manifestFilePath);
} catch (AutoIngestManager.AutoIngestManagerException ex) { } catch (AutoIngestManager.AutoIngestManagerException ex) {
SYS_LOGGER.log(Level.SEVERE, "Error prioritizing a job", ex); sysLogger.log(Level.SEVERE, "Error prioritizing a job", ex);
MessageNotifyUtil.Message.error(Bundle.AutoIngestControlPanel_errorMessage_jobPrioritization()); MessageNotifyUtil.Message.error(Bundle.AutoIngestControlPanel_errorMessage_jobPrioritization());
} }
refreshTables(); refreshTables();
@ -1930,7 +1930,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
try { try {
manager.deprioritizeCase(caseName); manager.deprioritizeCase(caseName);
} catch (AutoIngestManager.AutoIngestManagerException ex) { } catch (AutoIngestManager.AutoIngestManagerException ex) {
SYS_LOGGER.log(Level.SEVERE, "Error deprioritizing a case", ex); sysLogger.log(Level.SEVERE, "Error deprioritizing a case", ex);
MessageNotifyUtil.Message.error(Bundle.AutoIngestControlPanel_errorMessage_caseDeprioritization()); MessageNotifyUtil.Message.error(Bundle.AutoIngestControlPanel_errorMessage_caseDeprioritization());
} }
refreshTables(); refreshTables();
@ -1949,7 +1949,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
try { try {
manager.deprioritizeJob(manifestFilePath); manager.deprioritizeJob(manifestFilePath);
} catch (AutoIngestManager.AutoIngestManagerException ex) { } catch (AutoIngestManager.AutoIngestManagerException ex) {
SYS_LOGGER.log(Level.SEVERE, "Error deprioritizing a job", ex); sysLogger.log(Level.SEVERE, "Error deprioritizing a job", ex);
MessageNotifyUtil.Message.error(Bundle.AutoIngestControlPanel_errorMessage_jobDeprioritization()); MessageNotifyUtil.Message.error(Bundle.AutoIngestControlPanel_errorMessage_jobDeprioritization());
} }
refreshTables(); refreshTables();

View File

@ -76,6 +76,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback.DataSourceProcessorResult; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback.DataSourceProcessorResult;
import static org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS; import static org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.NetworkUtils; import org.sleuthkit.autopsy.coreutils.NetworkUtils;
import org.sleuthkit.autopsy.events.AutopsyEvent; import org.sleuthkit.autopsy.events.AutopsyEvent;
import org.sleuthkit.autopsy.events.AutopsyEventException; import org.sleuthkit.autopsy.events.AutopsyEventException;
@ -137,7 +138,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private static final String JOB_STATUS_PUBLISHING_THREAD_NAME = "AIM-job-status-event-publisher-%d"; private static final String JOB_STATUS_PUBLISHING_THREAD_NAME = "AIM-job-status-event-publisher-%d";
private static final long MAX_MISSED_JOB_STATUS_UPDATES = 10; private static final long MAX_MISSED_JOB_STATUS_UPDATES = 10;
private static final int DEFAULT_PRIORITY = 0; private static final int DEFAULT_PRIORITY = 0;
private static final java.util.logging.Logger SYS_LOGGER = AutoIngestSystemLogger.getLogger(); private static final Logger sysLogger = AutoIngestSystemLogger.getLogger();
private static AutoIngestManager instance; private static AutoIngestManager instance;
private final AutopsyEventPublisher eventPublisher; private final AutopsyEventPublisher eventPublisher;
private final Object scanMonitor; private final Object scanMonitor;
@ -184,7 +185,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* designated input directory tree. * designated input directory tree.
*/ */
private AutoIngestManager() { private AutoIngestManager() {
SYS_LOGGER.log(Level.INFO, "Initializing auto ingest"); sysLogger.log(Level.INFO, "Initializing auto ingest");
state = State.IDLE; state = State.IDLE;
eventPublisher = new AutopsyEventPublisher(); eventPublisher = new AutopsyEventPublisher();
scanMonitor = new Object(); scanMonitor = new Object();
@ -200,9 +201,9 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
completedJobs = new ArrayList<>(); completedJobs = new ArrayList<>();
try { try {
RuntimeProperties.setRunningWithGUI(false); RuntimeProperties.setRunningWithGUI(false);
SYS_LOGGER.log(Level.INFO, "Set running with desktop GUI runtime property to false"); sysLogger.log(Level.INFO, "Set running with desktop GUI runtime property to false");
} catch (RuntimeProperties.RuntimePropertiesException ex) { } catch (RuntimeProperties.RuntimePropertiesException ex) {
SYS_LOGGER.log(Level.SEVERE, "Failed to set running with desktop GUI runtime property to false", ex); sysLogger.log(Level.SEVERE, "Failed to set running with desktop GUI runtime property to false", ex);
} }
} }
@ -213,7 +214,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* ingest. * ingest.
*/ */
void startUp() throws AutoIngestManagerException { void startUp() throws AutoIngestManagerException {
SYS_LOGGER.log(Level.INFO, "Auto ingest starting"); sysLogger.log(Level.INFO, "Auto ingest starting");
try { try {
coordinationService = CoordinationService.getInstance(); coordinationService = CoordinationService.getInstance();
} catch (CoordinationServiceException ex) { } catch (CoordinationServiceException ex) {
@ -221,9 +222,9 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
} }
try { try {
eventPublisher.openRemoteEventChannel(EVENT_CHANNEL_NAME); eventPublisher.openRemoteEventChannel(EVENT_CHANNEL_NAME);
SYS_LOGGER.log(Level.INFO, "Opened auto ingest event channel"); sysLogger.log(Level.INFO, "Opened auto ingest event channel");
} catch (AutopsyEventException ex) { } catch (AutopsyEventException ex) {
SYS_LOGGER.log(Level.SEVERE, "Failed to open auto ingest event channel", ex); sysLogger.log(Level.SEVERE, "Failed to open auto ingest event channel", ex);
throw new AutoIngestManagerException("Failed to open auto ingest event channel", ex); throw new AutoIngestManagerException("Failed to open auto ingest event channel", ex);
} }
rootInputDirectory = Paths.get(AutoIngestUserPreferences.getAutoModeImageFolder()); rootInputDirectory = Paths.get(AutoIngestUserPreferences.getAutoModeImageFolder());
@ -396,7 +397,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
if (State.RUNNING != state) { if (State.RUNNING != state) {
return; return;
} }
SYS_LOGGER.log(Level.INFO, "Auto ingest shutting down"); sysLogger.log(Level.INFO, "Auto ingest shutting down");
state = State.SHUTTING_DOWN; state = State.SHUTTING_DOWN;
try { try {
eventPublisher.removeSubscriber(EVENT_LIST, instance); eventPublisher.removeSubscriber(EVENT_LIST, instance);
@ -406,9 +407,9 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
cleanupJobs(); cleanupJobs();
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
SYS_LOGGER.log(Level.SEVERE, "Auto ingest interrupted during shut down", ex); sysLogger.log(Level.SEVERE, "Auto ingest interrupted during shut down", ex);
} }
SYS_LOGGER.log(Level.INFO, "Auto ingest shut down"); sysLogger.log(Level.INFO, "Auto ingest shut down");
state = State.IDLE; state = State.IDLE;
} }
@ -420,10 +421,10 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
inputScanSchedulingExecutor.shutdownNow(); inputScanSchedulingExecutor.shutdownNow();
inputScanExecutor.shutdownNow(); inputScanExecutor.shutdownNow();
while (!inputScanSchedulingExecutor.awaitTermination(30, TimeUnit.SECONDS)) { while (!inputScanSchedulingExecutor.awaitTermination(30, TimeUnit.SECONDS)) {
SYS_LOGGER.log(Level.WARNING, "Auto ingest waited at least thirty seconds for input scan scheduling executor to shut down, continuing to wait"); //NON-NLS sysLogger.log(Level.WARNING, "Auto ingest waited at least thirty seconds for input scan scheduling executor to shut down, continuing to wait"); //NON-NLS
} }
while (!inputScanExecutor.awaitTermination(30, TimeUnit.SECONDS)) { while (!inputScanExecutor.awaitTermination(30, TimeUnit.SECONDS)) {
SYS_LOGGER.log(Level.WARNING, "Auto ingest waited at least thirty seconds for input scan executor to shut down, continuing to wait"); //NON-NLS sysLogger.log(Level.WARNING, "Auto ingest waited at least thirty seconds for input scan executor to shut down, continuing to wait"); //NON-NLS
} }
} }
@ -439,7 +440,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
jobProcessingExecutor.shutdown(); jobProcessingExecutor.shutdown();
} }
while (!jobProcessingExecutor.awaitTermination(30, TimeUnit.SECONDS)) { while (!jobProcessingExecutor.awaitTermination(30, TimeUnit.SECONDS)) {
SYS_LOGGER.log(Level.WARNING, "Auto ingest waited at least thirty seconds for job processing executor to shut down, continuing to wait"); //NON-NLS sysLogger.log(Level.WARNING, "Auto ingest waited at least thirty seconds for job processing executor to shut down, continuing to wait"); //NON-NLS
} }
} }
@ -506,11 +507,11 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
if (State.RUNNING != state) { if (State.RUNNING != state) {
return; return;
} }
SYS_LOGGER.log(Level.INFO, "Starting input scan of {0}", rootInputDirectory); sysLogger.log(Level.INFO, "Starting input scan of {0}", rootInputDirectory);
InputDirScanner scanner = new InputDirScanner(); InputDirScanner scanner = new InputDirScanner();
scanner.scan(); scanner.scan();
SYS_LOGGER.log(Level.INFO, "Completed input scan of {0}", rootInputDirectory); sysLogger.log(Level.INFO, "Completed input scan of {0}", rootInputDirectory);
} }
/** /**
@ -772,10 +773,10 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
updateCoordinationServiceManifestNode(completedJob); updateCoordinationServiceManifestNode(completedJob);
pendingJobs.add(completedJob); pendingJobs.add(completedJob);
} catch (CoordinationServiceException ex) { } catch (CoordinationServiceException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Coordination service error while reprocessing %s", manifestPath), ex); sysLogger.log(Level.SEVERE, String.format("Coordination service error while reprocessing %s", manifestPath), ex);
completedJobs.add(completedJob); completedJobs.add(completedJob);
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
SYS_LOGGER.log(Level.SEVERE, "Unexpected interrupt while updating coordination service node data for {0}", manifestPath); sysLogger.log(Level.SEVERE, "Unexpected interrupt while updating coordination service node data for {0}", manifestPath);
completedJobs.add(completedJob); completedJobs.add(completedJob);
} }
} }
@ -811,7 +812,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try { try {
metaData = new CaseMetadata(caseMetaDataFilePath); metaData = new CaseMetadata(caseMetaDataFilePath);
} catch (CaseMetadata.CaseMetadataException ex) { } catch (CaseMetadata.CaseMetadataException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Failed to get case metadata file %s for case %s at %s", caseMetaDataFilePath, caseName, caseDirectoryPath), ex); sysLogger.log(Level.SEVERE, String.format("Failed to get case metadata file %s for case %s at %s", caseMetaDataFilePath, caseName, caseDirectoryPath), ex);
return CaseDeletionResult.FAILED; return CaseDeletionResult.FAILED;
} }
@ -822,7 +823,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
scanner.scan(); scanner.scan();
Set<Path> manifestPaths = casesToManifests.get(caseName); Set<Path> manifestPaths = casesToManifests.get(caseName);
if (null == manifestPaths) { if (null == manifestPaths) {
SYS_LOGGER.log(Level.SEVERE, String.format("No manifest paths found for case %s at %s", caseName, caseDirectoryPath)); sysLogger.log(Level.SEVERE, String.format("No manifest paths found for case %s at %s", caseName, caseDirectoryPath));
return CaseDeletionResult.FAILED; return CaseDeletionResult.FAILED;
} }
@ -840,7 +841,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
return CaseDeletionResult.FAILED; return CaseDeletionResult.FAILED;
} }
} catch (CoordinationServiceException ex) { } catch (CoordinationServiceException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to acquire manifest lock for %s for case %s at %s", manifestPath, caseName, caseDirectoryPath), ex); sysLogger.log(Level.SEVERE, String.format("Error attempting to acquire manifest lock for %s for case %s at %s", manifestPath, caseName, caseDirectoryPath), ex);
return CaseDeletionResult.FAILED; return CaseDeletionResult.FAILED;
} }
} }
@ -851,7 +852,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/ */
Case.deleteCase(metaData); Case.deleteCase(metaData);
} catch (CaseActionException ex) { } catch (CaseActionException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Failed to physically delete case %s at %s", caseName, caseDirectoryPath), ex); sysLogger.log(Level.SEVERE, String.format("Failed to physically delete case %s at %s", caseName, caseDirectoryPath), ex);
return CaseDeletionResult.FAILED; return CaseDeletionResult.FAILED;
} }
@ -865,10 +866,10 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
deletedJob.setProcessingStatus(AutoIngestJob.ProcessingStatus.DELETED); deletedJob.setProcessingStatus(AutoIngestJob.ProcessingStatus.DELETED);
this.updateCoordinationServiceManifestNode(deletedJob); this.updateCoordinationServiceManifestNode(deletedJob);
} catch (AutoIngestJobNodeData.InvalidDataException | AutoIngestJobException ex) { } catch (AutoIngestJobNodeData.InvalidDataException | AutoIngestJobException ex) {
SYS_LOGGER.log(Level.WARNING, String.format("Invalid auto ingest job node data for %s", manifestPath), ex); sysLogger.log(Level.WARNING, String.format("Invalid auto ingest job node data for %s", manifestPath), ex);
return CaseDeletionResult.PARTIALLY_DELETED; return CaseDeletionResult.PARTIALLY_DELETED;
} catch (InterruptedException | CoordinationServiceException ex) { } catch (InterruptedException | CoordinationServiceException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to set delete flag on manifest data for %s for case %s at %s", manifestPath, caseName, caseDirectoryPath), ex); sysLogger.log(Level.SEVERE, String.format("Error attempting to set delete flag on manifest data for %s for case %s at %s", manifestPath, caseName, caseDirectoryPath), ex);
return CaseDeletionResult.PARTIALLY_DELETED; return CaseDeletionResult.PARTIALLY_DELETED;
} }
} }
@ -895,7 +896,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try { try {
lock.release(); lock.release();
} catch (CoordinationServiceException ex) { } catch (CoordinationServiceException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Failed to release manifest file lock when deleting case %s at %s", caseName, caseDirectoryPath), ex); sysLogger.log(Level.SEVERE, String.format("Failed to release manifest file lock when deleting case %s at %s", caseName, caseDirectoryPath), ex);
} }
} }
} }
@ -944,7 +945,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
synchronized (jobsLock) { synchronized (jobsLock) {
if (null != currentJob) { if (null != currentJob) {
currentJob.cancel(); currentJob.cancel();
SYS_LOGGER.log(Level.INFO, "Cancelling automated ingest for manifest {0}", currentJob.getManifest().getFilePath()); sysLogger.log(Level.INFO, "Cancelling automated ingest for manifest {0}", currentJob.getManifest().getFilePath());
} }
} }
} }
@ -965,7 +966,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
if (null != moduleHandle) { if (null != moduleHandle) {
currentJob.setProcessingStage(AutoIngestJob.Stage.CANCELLING_MODULE, Date.from(Instant.now())); currentJob.setProcessingStage(AutoIngestJob.Stage.CANCELLING_MODULE, Date.from(Instant.now()));
moduleHandle.cancel(); moduleHandle.cancel();
SYS_LOGGER.log(Level.INFO, "Cancelling {0} module for manifest {1}", new Object[]{moduleHandle.displayName(), currentJob.getManifest().getFilePath()}); sysLogger.log(Level.INFO, "Cancelling {0} module for manifest {1}", new Object[]{moduleHandle.displayName(), currentJob.getManifest().getFilePath()});
} }
} }
} }
@ -1015,7 +1016,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* input directory scan task executor. * input directory scan task executor.
*/ */
private InputDirScanSchedulingTask() { private InputDirScanSchedulingTask() {
SYS_LOGGER.log(Level.INFO, "Periodic input scan scheduling task started"); sysLogger.log(Level.INFO, "Periodic input scan scheduling task started");
} }
/** /**
@ -1045,10 +1046,10 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
if (Thread.currentThread().isInterrupted()) { if (Thread.currentThread().isInterrupted()) {
return null; return null;
} }
SYS_LOGGER.log(Level.INFO, "Starting input scan of {0}", rootInputDirectory); sysLogger.log(Level.INFO, "Starting input scan of {0}", rootInputDirectory);
InputDirScanner scanner = new InputDirScanner(); InputDirScanner scanner = new InputDirScanner();
scanner.scan(); scanner.scan();
SYS_LOGGER.log(Level.INFO, "Completed input scan of {0}", rootInputDirectory); sysLogger.log(Level.INFO, "Completed input scan of {0}", rootInputDirectory);
setChanged(); setChanged();
notifyObservers(Event.INPUT_SCAN_COMPLETED); notifyObservers(Event.INPUT_SCAN_COMPLETED);
return null; return null;
@ -1090,7 +1091,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* uncaught exceptions will propagate up to the calling * uncaught exceptions will propagate up to the calling
* thread and may stop it from running. * thread and may stop it from running.
*/ */
SYS_LOGGER.log(Level.SEVERE, String.format("Error scanning the input directory %s", rootInputDirectory), ex); sysLogger.log(Level.SEVERE, String.format("Error scanning the input directory %s", rootInputDirectory), ex);
} }
} }
synchronized (scanMonitor) { synchronized (scanMonitor) {
@ -1151,7 +1152,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
manifest = parser.parse(filePath); manifest = parser.parse(filePath);
break; break;
} catch (ManifestFileParserException ex) { } catch (ManifestFileParserException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to parse %s with parser %s", filePath, parser.getClass().getCanonicalName()), ex); sysLogger.log(Level.SEVERE, String.format("Error attempting to parse %s with parser %s", filePath, parser.getClass().getCanonicalName()), ex);
} }
} }
if (Thread.currentThread().isInterrupted()) { if (Thread.currentThread().isInterrupted()) {
@ -1205,21 +1206,21 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/ */
break; break;
default: default:
SYS_LOGGER.log(Level.SEVERE, "Unknown ManifestNodeData.ProcessingStatus"); sysLogger.log(Level.SEVERE, "Unknown ManifestNodeData.ProcessingStatus");
break; break;
} }
} catch (AutoIngestJobNodeData.InvalidDataException | AutoIngestJobException ex) { } catch (AutoIngestJobNodeData.InvalidDataException | AutoIngestJobException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Invalid auto ingest job node data for %s", manifestPath), ex); sysLogger.log(Level.SEVERE, String.format("Invalid auto ingest job node data for %s", manifestPath), ex);
} }
} else { } else {
try { try {
addNewPendingJob(manifest); addNewPendingJob(manifest);
} catch (AutoIngestJobException ex) { } catch (AutoIngestJobException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Invalid manifest data for %s", manifestPath), ex); sysLogger.log(Level.SEVERE, String.format("Invalid manifest data for %s", manifestPath), ex);
} }
} }
} catch (CoordinationServiceException ex) { } catch (CoordinationServiceException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error transmitting node data for %s", manifestPath), ex); sysLogger.log(Level.SEVERE, String.format("Error transmitting node data for %s", manifestPath), ex);
return CONTINUE; return CONTINUE;
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
@ -1231,7 +1232,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
// Catch all unhandled and unexpected exceptions. Otherwise one bad file // Catch all unhandled and unexpected exceptions. Otherwise one bad file
// can stop the entire input folder scanning. Given that the exception is unexpected, // can stop the entire input folder scanning. Given that the exception is unexpected,
// I'm hesitant to add logging which requires accessing or de-referencing data. // I'm hesitant to add logging which requires accessing or de-referencing data.
SYS_LOGGER.log(Level.SEVERE, "Unexpected exception in file visitor", ex); sysLogger.log(Level.SEVERE, "Unexpected exception in file visitor", ex);
return CONTINUE; return CONTINUE;
} }
@ -1288,7 +1289,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
updateCoordinationServiceManifestNode(job); updateCoordinationServiceManifestNode(job);
} }
} catch (CoordinationServiceException ex) { } catch (CoordinationServiceException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex); sysLogger.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex);
} }
} }
Path caseDirectory = PathUtils.findCaseDirectory(rootOutputDirectory, manifest.getCaseName()); Path caseDirectory = PathUtils.findCaseDirectory(rootOutputDirectory, manifest.getCaseName());
@ -1330,7 +1331,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
newPendingJobsList.add(job); newPendingJobsList.add(job);
} }
} catch (CoordinationServiceException ex) { } catch (CoordinationServiceException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex); sysLogger.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex);
} }
} }
@ -1361,7 +1362,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
String manifestPath = manifest.getFilePath().toString(); String manifestPath = manifest.getFilePath().toString();
try (Lock manifestLock = coordinationService.tryGetExclusiveLock(CoordinationService.CategoryNode.MANIFESTS, manifestPath)) { try (Lock manifestLock = coordinationService.tryGetExclusiveLock(CoordinationService.CategoryNode.MANIFESTS, manifestPath)) {
if (null != manifestLock) { if (null != manifestLock) {
SYS_LOGGER.log(Level.SEVERE, "Attempting crash recovery for {0}", manifestPath); sysLogger.log(Level.SEVERE, "Attempting crash recovery for {0}", manifestPath);
try { try {
Path caseDirectoryPath = PathUtils.findCaseDirectory(rootOutputDirectory, manifest.getCaseName()); Path caseDirectoryPath = PathUtils.findCaseDirectory(rootOutputDirectory, manifest.getCaseName());
@ -1386,7 +1387,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try { try {
setCaseNodeDataErrorsOccurred(caseDirectoryPath); setCaseNodeDataErrorsOccurred(caseDirectoryPath);
} catch (CaseNodeData.InvalidDataException ex) { } catch (CaseNodeData.InvalidDataException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to get case node data for %s", caseDirectoryPath), ex); sysLogger.log(Level.SEVERE, String.format("Error attempting to get case node data for %s", caseDirectoryPath), ex);
} }
} else { } else {
job.setErrorsOccurred(false); job.setErrorsOccurred(false);
@ -1398,7 +1399,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try { try {
new AutoIngestJobLogger(manifest.getFilePath(), manifest.getDataSourceFileName(), caseDirectoryPath).logCrashRecoveryWithRetry(); new AutoIngestJobLogger(manifest.getFilePath(), manifest.getDataSourceFileName(), caseDirectoryPath).logCrashRecoveryWithRetry();
} catch (AutoIngestJobLoggerException ex) { } catch (AutoIngestJobLoggerException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error creating case auto ingest log entry for crashed job for %s", manifestPath), ex); sysLogger.log(Level.SEVERE, String.format("Error creating case auto ingest log entry for crashed job for %s", manifestPath), ex);
} }
} }
} else { } else {
@ -1407,7 +1408,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try { try {
new AutoIngestJobLogger(manifest.getFilePath(), manifest.getDataSourceFileName(), caseDirectoryPath).logCrashRecoveryNoRetry(); new AutoIngestJobLogger(manifest.getFilePath(), manifest.getDataSourceFileName(), caseDirectoryPath).logCrashRecoveryNoRetry();
} catch (AutoIngestJobLoggerException ex) { } catch (AutoIngestJobLoggerException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error creating case auto ingest log entry for crashed job for %s", manifestPath), ex); sysLogger.log(Level.SEVERE, String.format("Error creating case auto ingest log entry for crashed job for %s", manifestPath), ex);
} }
} }
} }
@ -1419,7 +1420,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try { try {
updateCoordinationServiceManifestNode(job); updateCoordinationServiceManifestNode(job);
} catch (CoordinationServiceException ex) { } catch (CoordinationServiceException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifestPath), ex); sysLogger.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifestPath), ex);
return; return;
} }
@ -1435,12 +1436,12 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try { try {
manifestLock.release(); manifestLock.release();
} catch (CoordinationServiceException ex) { } catch (CoordinationServiceException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to release exclusive lock for %s", manifestPath), ex); sysLogger.log(Level.SEVERE, String.format("Error attempting to release exclusive lock for %s", manifestPath), ex);
} }
} }
} }
} catch (CoordinationServiceException ex) { } catch (CoordinationServiceException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to get exclusive lock for %s", manifestPath), ex); sysLogger.log(Level.SEVERE, String.format("Error attempting to get exclusive lock for %s", manifestPath), ex);
} }
} }
@ -1495,13 +1496,13 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
updateCoordinationServiceManifestNode(job); updateCoordinationServiceManifestNode(job);
} }
} catch (CoordinationServiceException ex) { } catch (CoordinationServiceException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex); sysLogger.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex);
} }
} }
newCompletedJobsList.add(job); newCompletedJobsList.add(job);
} else { } else {
SYS_LOGGER.log(Level.WARNING, String.format("Job completed for %s, but cannot find case directory, ignoring job", nodeData.getManifestFilePath())); sysLogger.log(Level.WARNING, String.format("Job completed for %s, but cannot find case directory, ignoring job", nodeData.getManifestFilePath()));
} }
} }
@ -1522,7 +1523,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/ */
@Override @Override
public FileVisitResult visitFileFailed(Path file, IOException ex) throws IOException { public FileVisitResult visitFileFailed(Path file, IOException ex) throws IOException {
SYS_LOGGER.log(Level.SEVERE, String.format("Error while visiting %s during input directories scan", file.toString()), ex); sysLogger.log(Level.SEVERE, String.format("Error while visiting %s during input directories scan", file.toString()), ex);
if (Thread.currentThread().isInterrupted()) { if (Thread.currentThread().isInterrupted()) {
return TERMINATE; return TERMINATE;
} }
@ -1607,7 +1608,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/ */
@Override @Override
public void run() { public void run() {
SYS_LOGGER.log(Level.INFO, "Job processing task started"); sysLogger.log(Level.INFO, "Job processing task started");
while (true) { while (true) {
try { try {
if (jobProcessingTaskFuture.isCancelled()) { if (jobProcessingTaskFuture.isCancelled()) {
@ -1650,14 +1651,14 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
} else { } else {
errorState = ErrorState.UNEXPECTED_EXCEPTION; errorState = ErrorState.UNEXPECTED_EXCEPTION;
} }
SYS_LOGGER.log(Level.SEVERE, "Auto ingest system error", ex); sysLogger.log(Level.SEVERE, "Auto ingest system error", ex);
pauseForSystemError(); pauseForSystemError();
} }
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
break; break;
} }
} }
SYS_LOGGER.log(Level.INFO, "Job processing task stopped"); sysLogger.log(Level.INFO, "Job processing task stopped");
} }
/** /**
@ -1666,7 +1667,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/ */
private void requestPause() { private void requestPause() {
synchronized (pauseLock) { synchronized (pauseLock) {
SYS_LOGGER.log(Level.INFO, "Job processing pause requested"); sysLogger.log(Level.INFO, "Job processing pause requested");
pauseRequested = true; pauseRequested = true;
if (waitingForInputScan) { if (waitingForInputScan) {
/* /*
@ -1689,7 +1690,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/ */
private void requestResume() { private void requestResume() {
synchronized (pauseLock) { synchronized (pauseLock) {
SYS_LOGGER.log(Level.INFO, "Job processing resume requested"); sysLogger.log(Level.INFO, "Job processing resume requested");
pauseRequested = false; pauseRequested = false;
if (waitingForInputScan) { if (waitingForInputScan) {
/* /*
@ -1719,12 +1720,12 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private void pauseIfRequested() throws InterruptedException { private void pauseIfRequested() throws InterruptedException {
synchronized (pauseLock) { synchronized (pauseLock) {
if (pauseRequested) { if (pauseRequested) {
SYS_LOGGER.log(Level.INFO, "Job processing paused by request"); sysLogger.log(Level.INFO, "Job processing paused by request");
pauseRequested = false; pauseRequested = false;
setChanged(); setChanged();
notifyObservers(Event.PAUSED_BY_REQUEST); notifyObservers(Event.PAUSED_BY_REQUEST);
pauseLock.wait(); pauseLock.wait();
SYS_LOGGER.log(Level.INFO, "Job processing resumed after pause request"); sysLogger.log(Level.INFO, "Job processing resumed after pause request");
setChanged(); setChanged();
notifyObservers(Event.RESUMED); notifyObservers(Event.RESUMED);
} }
@ -1740,12 +1741,12 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/ */
private void pauseForSystemError() throws InterruptedException { private void pauseForSystemError() throws InterruptedException {
synchronized (pauseLock) { synchronized (pauseLock) {
SYS_LOGGER.log(Level.SEVERE, "Job processing paused for system error"); sysLogger.log(Level.SEVERE, "Job processing paused for system error");
setChanged(); setChanged();
notifyObservers(Event.PAUSED_FOR_SYSTEM_ERROR); notifyObservers(Event.PAUSED_FOR_SYSTEM_ERROR);
pauseLock.wait(); pauseLock.wait();
errorState = ErrorState.NONE; errorState = ErrorState.NONE;
SYS_LOGGER.log(Level.INFO, "Job processing resumed after system error"); sysLogger.log(Level.INFO, "Job processing resumed after system error");
setChanged(); setChanged();
notifyObservers(Event.RESUMED); notifyObservers(Event.RESUMED);
} }
@ -1775,11 +1776,11 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/ */
waitingForInputScan = true; waitingForInputScan = true;
} }
SYS_LOGGER.log(Level.INFO, "Job processing waiting for input scan completion"); sysLogger.log(Level.INFO, "Job processing waiting for input scan completion");
synchronized (scanMonitor) { synchronized (scanMonitor) {
scanMonitor.wait(); scanMonitor.wait();
} }
SYS_LOGGER.log(Level.INFO, "Job processing finished wait for input scan completion"); sysLogger.log(Level.INFO, "Job processing finished wait for input scan completion");
synchronized (pauseLock) { synchronized (pauseLock) {
waitingForInputScan = false; waitingForInputScan = false;
pauseIfRequested(); pauseIfRequested();
@ -1845,7 +1846,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* job. * job.
*/ */
private void processJobs() throws CoordinationServiceException, SharedConfigurationException, ServicesMonitorException, DatabaseServerDownException, KeywordSearchServerDownException, CaseManagementException, AnalysisStartupException, FileExportException, AutoIngestJobLoggerException, InterruptedException, AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException, AutoIngestJobNodeData.InvalidDataException, CaseNodeData.InvalidDataException, JobMetricsCollectionException { private void processJobs() throws CoordinationServiceException, SharedConfigurationException, ServicesMonitorException, DatabaseServerDownException, KeywordSearchServerDownException, CaseManagementException, AnalysisStartupException, FileExportException, AutoIngestJobLoggerException, InterruptedException, AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException, AutoIngestJobNodeData.InvalidDataException, CaseNodeData.InvalidDataException, JobMetricsCollectionException {
SYS_LOGGER.log(Level.INFO, "Started processing pending jobs queue"); sysLogger.log(Level.INFO, "Started processing pending jobs queue");
Lock manifestLock = JobProcessingTask.this.dequeueAndLockNextJob(); Lock manifestLock = JobProcessingTask.this.dequeueAndLockNextJob();
while (null != manifestLock) { while (null != manifestLock) {
try { try {
@ -1895,20 +1896,20 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* while reading the lock data * while reading the lock data
*/ */
private Lock dequeueAndLockNextJob() throws CoordinationServiceException, InterruptedException { private Lock dequeueAndLockNextJob() throws CoordinationServiceException, InterruptedException {
SYS_LOGGER.log(Level.INFO, "Checking pending jobs queue for ready job, enforcing max jobs per case"); sysLogger.log(Level.INFO, "Checking pending jobs queue for ready job, enforcing max jobs per case");
Lock manifestLock; Lock manifestLock;
synchronized (jobsLock) { synchronized (jobsLock) {
manifestLock = dequeueAndLockNextJob(true); manifestLock = dequeueAndLockNextJob(true);
if (null != manifestLock) { if (null != manifestLock) {
SYS_LOGGER.log(Level.INFO, "Dequeued job for {0}", currentJob.getManifest().getFilePath()); sysLogger.log(Level.INFO, "Dequeued job for {0}", currentJob.getManifest().getFilePath());
} else { } else {
SYS_LOGGER.log(Level.INFO, "No ready job"); sysLogger.log(Level.INFO, "No ready job");
SYS_LOGGER.log(Level.INFO, "Checking pending jobs queue for ready job, not enforcing max jobs per case"); sysLogger.log(Level.INFO, "Checking pending jobs queue for ready job, not enforcing max jobs per case");
manifestLock = dequeueAndLockNextJob(false); manifestLock = dequeueAndLockNextJob(false);
if (null != manifestLock) { if (null != manifestLock) {
SYS_LOGGER.log(Level.INFO, "Dequeued job for {0}", currentJob.getManifest().getFilePath()); sysLogger.log(Level.INFO, "Dequeued job for {0}", currentJob.getManifest().getFilePath());
} else { } else {
SYS_LOGGER.log(Level.INFO, "No ready job"); sysLogger.log(Level.INFO, "No ready job");
} }
} }
} }
@ -1980,7 +1981,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
currentJob = job; currentJob = job;
break; break;
} catch (AutoIngestJobNodeData.InvalidDataException ex) { } catch (AutoIngestJobNodeData.InvalidDataException ex) {
SYS_LOGGER.log(Level.WARNING, String.format("Unable to use node data for %s", manifestPath), ex); // JCTODO: Is this right? sysLogger.log(Level.WARNING, String.format("Unable to use node data for %s", manifestPath), ex); // JCTODO: Is this right?
} }
} }
} }
@ -2047,7 +2048,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/ */
private void processJob() throws CoordinationServiceException, SharedConfigurationException, ServicesMonitorException, DatabaseServerDownException, KeywordSearchServerDownException, CaseManagementException, AnalysisStartupException, FileExportException, AutoIngestJobLoggerException, InterruptedException, AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException, CaseNodeData.InvalidDataException, JobMetricsCollectionException { private void processJob() throws CoordinationServiceException, SharedConfigurationException, ServicesMonitorException, DatabaseServerDownException, KeywordSearchServerDownException, CaseManagementException, AnalysisStartupException, FileExportException, AutoIngestJobLoggerException, InterruptedException, AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException, CaseNodeData.InvalidDataException, JobMetricsCollectionException {
Path manifestPath = currentJob.getManifest().getFilePath(); Path manifestPath = currentJob.getManifest().getFilePath();
SYS_LOGGER.log(Level.INFO, "Started processing of {0}", manifestPath); sysLogger.log(Level.INFO, "Started processing of {0}", manifestPath);
currentJob.setProcessingStatus(AutoIngestJob.ProcessingStatus.PROCESSING); currentJob.setProcessingStatus(AutoIngestJob.ProcessingStatus.PROCESSING);
currentJob.setProcessingStage(AutoIngestJob.Stage.STARTING, Date.from(Instant.now())); currentJob.setProcessingStage(AutoIngestJob.Stage.STARTING, Date.from(Instant.now()));
currentJob.setProcessingHostName(AutoIngestManager.LOCAL_HOST_NAME); currentJob.setProcessingHostName(AutoIngestManager.LOCAL_HOST_NAME);
@ -2078,7 +2079,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
updateCoordinationServiceManifestNode(currentJob); updateCoordinationServiceManifestNode(currentJob);
boolean retry = (!currentJob.isCanceled() && !currentJob.isCompleted()); boolean retry = (!currentJob.isCanceled() && !currentJob.isCompleted());
SYS_LOGGER.log(Level.INFO, "Completed processing of {0}, retry = {1}", new Object[]{manifestPath, retry}); sysLogger.log(Level.INFO, "Completed processing of {0}, retry = {1}", new Object[]{manifestPath, retry});
if (currentJob.isCanceled()) { if (currentJob.isCanceled()) {
Path caseDirectoryPath = currentJob.getCaseDirectoryPath(); Path caseDirectoryPath = currentJob.getCaseDirectoryPath();
if (null != caseDirectoryPath) { if (null != caseDirectoryPath) {
@ -2173,7 +2174,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private void updateConfiguration() throws SharedConfigurationException, InterruptedException { private void updateConfiguration() throws SharedConfigurationException, InterruptedException {
if (AutoIngestUserPreferences.getSharedConfigEnabled()) { if (AutoIngestUserPreferences.getSharedConfigEnabled()) {
Path manifestPath = currentJob.getManifest().getFilePath(); Path manifestPath = currentJob.getManifest().getFilePath();
SYS_LOGGER.log(Level.INFO, "Downloading shared configuration for {0}", manifestPath); sysLogger.log(Level.INFO, "Downloading shared configuration for {0}", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.UPDATING_SHARED_CONFIG, Date.from(Instant.now())); currentJob.setProcessingStage(AutoIngestJob.Stage.UPDATING_SHARED_CONFIG, Date.from(Instant.now()));
new SharedConfiguration().downloadConfiguration(); new SharedConfiguration().downloadConfiguration();
} }
@ -2191,7 +2192,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/ */
private void verifyRequiredSevicesAreRunning() throws ServicesMonitorException, DatabaseServerDownException, KeywordSearchServerDownException { private void verifyRequiredSevicesAreRunning() throws ServicesMonitorException, DatabaseServerDownException, KeywordSearchServerDownException {
Path manifestPath = currentJob.getManifest().getFilePath(); Path manifestPath = currentJob.getManifest().getFilePath();
SYS_LOGGER.log(Level.INFO, "Checking services availability for {0}", manifestPath); sysLogger.log(Level.INFO, "Checking services availability for {0}", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.CHECKING_SERVICES, Date.from(Instant.now())); currentJob.setProcessingStage(AutoIngestJob.Stage.CHECKING_SERVICES, Date.from(Instant.now()));
if (!isServiceUp(ServicesMonitor.Service.REMOTE_CASE_DATABASE.toString())) { if (!isServiceUp(ServicesMonitor.Service.REMOTE_CASE_DATABASE.toString())) {
throw new DatabaseServerDownException("Case database server is down"); throw new DatabaseServerDownException("Case database server is down");
@ -2238,7 +2239,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private Case openCase() throws CoordinationServiceException, CaseManagementException, InterruptedException { private Case openCase() throws CoordinationServiceException, CaseManagementException, InterruptedException {
Manifest manifest = currentJob.getManifest(); Manifest manifest = currentJob.getManifest();
String caseName = manifest.getCaseName(); String caseName = manifest.getCaseName();
SYS_LOGGER.log(Level.INFO, "Opening case {0} for {1}", new Object[]{caseName, manifest.getFilePath()}); sysLogger.log(Level.INFO, "Opening case {0} for {1}", new Object[]{caseName, manifest.getFilePath()});
currentJob.setProcessingStage(AutoIngestJob.Stage.OPENING_CASE, Date.from(Instant.now())); currentJob.setProcessingStage(AutoIngestJob.Stage.OPENING_CASE, Date.from(Instant.now()));
/* /*
* Acquire and hold a case name lock so that only one node at as * Acquire and hold a case name lock so that only one node at as
@ -2272,7 +2273,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
} }
currentJob.setCaseDirectoryPath(caseDirectoryPath); currentJob.setCaseDirectoryPath(caseDirectoryPath);
Case caseForJob = Case.getOpenCase(); Case caseForJob = Case.getOpenCase();
SYS_LOGGER.log(Level.INFO, "Opened case {0} for {1}", new Object[]{caseForJob.getName(), manifest.getFilePath()}); sysLogger.log(Level.INFO, "Opened case {0} for {1}", new Object[]{caseForJob.getName(), manifest.getFilePath()});
return caseForJob; return caseForJob;
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {
@ -2417,14 +2418,14 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private AutoIngestDataSource identifyDataSource() throws AutoIngestJobLoggerException, InterruptedException, CaseNodeData.InvalidDataException, CoordinationServiceException { private AutoIngestDataSource identifyDataSource() throws AutoIngestJobLoggerException, InterruptedException, CaseNodeData.InvalidDataException, CoordinationServiceException {
Manifest manifest = currentJob.getManifest(); Manifest manifest = currentJob.getManifest();
Path manifestPath = manifest.getFilePath(); Path manifestPath = manifest.getFilePath();
SYS_LOGGER.log(Level.INFO, "Identifying data source for {0} ", manifestPath); sysLogger.log(Level.INFO, "Identifying data source for {0} ", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.IDENTIFYING_DATA_SOURCE, Date.from(Instant.now())); currentJob.setProcessingStage(AutoIngestJob.Stage.IDENTIFYING_DATA_SOURCE, Date.from(Instant.now()));
Path caseDirectoryPath = currentJob.getCaseDirectoryPath(); Path caseDirectoryPath = currentJob.getCaseDirectoryPath();
AutoIngestJobLogger jobLogger = new AutoIngestJobLogger(manifestPath, manifest.getDataSourceFileName(), caseDirectoryPath); AutoIngestJobLogger jobLogger = new AutoIngestJobLogger(manifestPath, manifest.getDataSourceFileName(), caseDirectoryPath);
Path dataSourcePath = manifest.getDataSourcePath(); Path dataSourcePath = manifest.getDataSourcePath();
File dataSource = dataSourcePath.toFile(); File dataSource = dataSourcePath.toFile();
if (!dataSource.exists()) { if (!dataSource.exists()) {
SYS_LOGGER.log(Level.SEVERE, "Missing data source for {0}", manifestPath); sysLogger.log(Level.SEVERE, "Missing data source for {0}", manifestPath);
currentJob.setErrorsOccurred(true); currentJob.setErrorsOccurred(true);
setCaseNodeDataErrorsOccurred(caseDirectoryPath); setCaseNodeDataErrorsOccurred(caseDirectoryPath);
jobLogger.logMissingDataSource(); jobLogger.logMissingDataSource();
@ -2451,7 +2452,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private void runDataSourceProcessor(Case caseForJob, AutoIngestDataSource dataSource) throws InterruptedException, AutoIngestJobLoggerException, AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException, CaseNodeData.InvalidDataException, CoordinationServiceException { private void runDataSourceProcessor(Case caseForJob, AutoIngestDataSource dataSource) throws InterruptedException, AutoIngestJobLoggerException, AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException, CaseNodeData.InvalidDataException, CoordinationServiceException {
Manifest manifest = currentJob.getManifest(); Manifest manifest = currentJob.getManifest();
Path manifestPath = manifest.getFilePath(); Path manifestPath = manifest.getFilePath();
SYS_LOGGER.log(Level.INFO, "Adding data source for {0} ", manifestPath); sysLogger.log(Level.INFO, "Adding data source for {0} ", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.ADDING_DATA_SOURCE, Date.from(Instant.now())); currentJob.setProcessingStage(AutoIngestJob.Stage.ADDING_DATA_SOURCE, Date.from(Instant.now()));
DataSourceProcessorProgressMonitor progressMonitor = new DoNothingDSPProgressMonitor(); DataSourceProcessorProgressMonitor progressMonitor = new DoNothingDSPProgressMonitor();
Path caseDirectoryPath = currentJob.getCaseDirectoryPath(); Path caseDirectoryPath = currentJob.getCaseDirectoryPath();
@ -2463,7 +2464,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try { try {
validDataSourceProcessors = DataSourceProcessorUtility.getOrderedListOfDataSourceProcessors(dataSource.getPath()); validDataSourceProcessors = DataSourceProcessorUtility.getOrderedListOfDataSourceProcessors(dataSource.getPath());
} catch (AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException ex) { } catch (AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException ex) {
SYS_LOGGER.log(Level.SEVERE, "Exception while determining best data source processor for {0}", dataSource.getPath()); sysLogger.log(Level.SEVERE, "Exception while determining best data source processor for {0}", dataSource.getPath());
// rethrow the exception. It will get caught & handled upstream and will result in AIM auto-pause. // rethrow the exception. It will get caught & handled upstream and will result in AIM auto-pause.
throw ex; throw ex;
} }
@ -2474,7 +2475,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
setCaseNodeDataErrorsOccurred(caseDirectoryPath); setCaseNodeDataErrorsOccurred(caseDirectoryPath);
currentJob.setErrorsOccurred(true); currentJob.setErrorsOccurred(true);
jobLogger.logFailedToIdentifyDataSource(); jobLogger.logFailedToIdentifyDataSource();
SYS_LOGGER.log(Level.WARNING, "Unsupported data source {0} for {1}", new Object[]{dataSource.getPath(), manifestPath}); // NON-NLS sysLogger.log(Level.WARNING, "Unsupported data source {0} for {1}", new Object[]{dataSource.getPath(), manifestPath}); // NON-NLS
return; return;
} }
@ -2486,7 +2487,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
DataSourceProcessorCallback callBack = new AddDataSourceCallback(caseForJob, dataSource, taskId, ingestLock); DataSourceProcessorCallback callBack = new AddDataSourceCallback(caseForJob, dataSource, taskId, ingestLock);
caseForJob.notifyAddingDataSource(taskId); caseForJob.notifyAddingDataSource(taskId);
jobLogger.logDataSourceProcessorSelected(selectedProcessor.getDataSourceType()); jobLogger.logDataSourceProcessorSelected(selectedProcessor.getDataSourceType());
SYS_LOGGER.log(Level.INFO, "Identified data source type for {0} as {1}", new Object[]{manifestPath, selectedProcessor.getDataSourceType()}); sysLogger.log(Level.INFO, "Identified data source type for {0} as {1}", new Object[]{manifestPath, selectedProcessor.getDataSourceType()});
selectedProcessor.process(dataSource.getDeviceId(), dataSource.getPath(), progressMonitor, callBack); selectedProcessor.process(dataSource.getDeviceId(), dataSource.getPath(), progressMonitor, callBack);
ingestLock.wait(); ingestLock.wait();
@ -2504,7 +2505,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
return; return;
} }
// If we get to this point, none of the processors were successful // If we get to this point, none of the processors were successful
SYS_LOGGER.log(Level.SEVERE, "All data source processors failed to process {0}", dataSource.getPath()); sysLogger.log(Level.SEVERE, "All data source processors failed to process {0}", dataSource.getPath());
jobLogger.logFailedToAddDataSource(); jobLogger.logFailedToAddDataSource();
setCaseNodeDataErrorsOccurred(caseDirectoryPath); setCaseNodeDataErrorsOccurred(caseDirectoryPath);
currentJob.setErrorsOccurred(true); currentJob.setErrorsOccurred(true);
@ -2547,7 +2548,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
case NONCRITICAL_ERRORS: case NONCRITICAL_ERRORS:
for (String errorMessage : dataSource.getDataSourceProcessorErrorMessages()) { for (String errorMessage : dataSource.getDataSourceProcessorErrorMessages()) {
SYS_LOGGER.log(Level.WARNING, "Non-critical error running data source processor for {0}: {1}", new Object[]{manifestPath, errorMessage}); sysLogger.log(Level.WARNING, "Non-critical error running data source processor for {0}: {1}", new Object[]{manifestPath, errorMessage});
} }
jobLogger.logDataSourceAdded(); jobLogger.logDataSourceAdded();
if (dataSource.getContent().isEmpty()) { if (dataSource.getContent().isEmpty()) {
@ -2557,7 +2558,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
case CRITICAL_ERRORS: case CRITICAL_ERRORS:
for (String errorMessage : dataSource.getDataSourceProcessorErrorMessages()) { for (String errorMessage : dataSource.getDataSourceProcessorErrorMessages()) {
SYS_LOGGER.log(Level.SEVERE, "Critical error running data source processor for {0}: {1}", new Object[]{manifestPath, errorMessage}); sysLogger.log(Level.SEVERE, "Critical error running data source processor for {0}: {1}", new Object[]{manifestPath, errorMessage});
} }
jobLogger.logFailedToAddDataSource(); jobLogger.logFailedToAddDataSource();
break; break;
@ -2570,7 +2571,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* AutoIngestJob and calling cancel on the DSP, if not null, in * AutoIngestJob and calling cancel on the DSP, if not null, in
* cancelCurrentJob. * cancelCurrentJob.
*/ */
SYS_LOGGER.log(Level.WARNING, "Cancellation while waiting for data source processor for {0}", manifestPath); sysLogger.log(Level.WARNING, "Cancellation while waiting for data source processor for {0}", manifestPath);
jobLogger.logDataSourceProcessorCancelled(); jobLogger.logDataSourceProcessorCancelled();
} }
} }
@ -2595,7 +2596,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private void analyze(AutoIngestDataSource dataSource) throws AnalysisStartupException, AutoIngestJobLoggerException, InterruptedException, CaseNodeData.InvalidDataException, CoordinationServiceException { private void analyze(AutoIngestDataSource dataSource) throws AnalysisStartupException, AutoIngestJobLoggerException, InterruptedException, CaseNodeData.InvalidDataException, CoordinationServiceException {
Manifest manifest = currentJob.getManifest(); Manifest manifest = currentJob.getManifest();
Path manifestPath = manifest.getFilePath(); Path manifestPath = manifest.getFilePath();
SYS_LOGGER.log(Level.INFO, "Starting ingest modules analysis for {0} ", manifestPath); sysLogger.log(Level.INFO, "Starting ingest modules analysis for {0} ", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.ANALYZING_DATA_SOURCE, Date.from(Instant.now())); currentJob.setProcessingStage(AutoIngestJob.Stage.ANALYZING_DATA_SOURCE, Date.from(Instant.now()));
Path caseDirectoryPath = currentJob.getCaseDirectoryPath(); Path caseDirectoryPath = currentJob.getCaseDirectoryPath();
AutoIngestJobLogger jobLogger = new AutoIngestJobLogger(manifestPath, manifest.getDataSourceFileName(), caseDirectoryPath); AutoIngestJobLogger jobLogger = new AutoIngestJobLogger(manifestPath, manifest.getDataSourceFileName(), caseDirectoryPath);
@ -2616,17 +2617,17 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* is shutting down. * is shutting down.
*/ */
ingestLock.wait(); ingestLock.wait();
SYS_LOGGER.log(Level.INFO, "Finished ingest modules analysis for {0} ", manifestPath); sysLogger.log(Level.INFO, "Finished ingest modules analysis for {0} ", manifestPath);
IngestJob.ProgressSnapshot jobSnapshot = ingestJob.getSnapshot(); IngestJob.ProgressSnapshot jobSnapshot = ingestJob.getSnapshot();
for (IngestJob.ProgressSnapshot.DataSourceProcessingSnapshot snapshot : jobSnapshot.getDataSourceSnapshots()) { for (IngestJob.ProgressSnapshot.DataSourceProcessingSnapshot snapshot : jobSnapshot.getDataSourceSnapshots()) {
if (!snapshot.isCancelled()) { if (!snapshot.isCancelled()) {
List<String> cancelledModules = snapshot.getCancelledDataSourceIngestModules(); List<String> cancelledModules = snapshot.getCancelledDataSourceIngestModules();
if (!cancelledModules.isEmpty()) { if (!cancelledModules.isEmpty()) {
SYS_LOGGER.log(Level.WARNING, String.format("Ingest module(s) cancelled for %s", manifestPath)); sysLogger.log(Level.WARNING, String.format("Ingest module(s) cancelled for %s", manifestPath));
currentJob.setErrorsOccurred(true); currentJob.setErrorsOccurred(true);
setCaseNodeDataErrorsOccurred(caseDirectoryPath); setCaseNodeDataErrorsOccurred(caseDirectoryPath);
for (String module : snapshot.getCancelledDataSourceIngestModules()) { for (String module : snapshot.getCancelledDataSourceIngestModules()) {
SYS_LOGGER.log(Level.WARNING, String.format("%s ingest module cancelled for %s", module, manifestPath)); sysLogger.log(Level.WARNING, String.format("%s ingest module cancelled for %s", module, manifestPath));
jobLogger.logIngestModuleCancelled(module); jobLogger.logIngestModuleCancelled(module);
} }
} }
@ -2644,14 +2645,14 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
} }
} else if (!ingestJobStartResult.getModuleErrors().isEmpty()) { } else if (!ingestJobStartResult.getModuleErrors().isEmpty()) {
for (IngestModuleError error : ingestJobStartResult.getModuleErrors()) { for (IngestModuleError error : ingestJobStartResult.getModuleErrors()) {
SYS_LOGGER.log(Level.SEVERE, String.format("%s ingest module startup error for %s", error.getModuleDisplayName(), manifestPath), error.getThrowable()); sysLogger.log(Level.SEVERE, String.format("%s ingest module startup error for %s", error.getModuleDisplayName(), manifestPath), error.getThrowable());
} }
currentJob.setErrorsOccurred(true); currentJob.setErrorsOccurred(true);
setCaseNodeDataErrorsOccurred(caseDirectoryPath); setCaseNodeDataErrorsOccurred(caseDirectoryPath);
jobLogger.logIngestModuleStartupErrors(); jobLogger.logIngestModuleStartupErrors();
throw new AnalysisStartupException(String.format("Error(s) during ingest module startup for %s", manifestPath)); throw new AnalysisStartupException(String.format("Error(s) during ingest module startup for %s", manifestPath));
} else { } else {
SYS_LOGGER.log(Level.SEVERE, String.format("Ingest manager ingest job start error for %s", manifestPath), ingestJobStartResult.getStartupException()); sysLogger.log(Level.SEVERE, String.format("Ingest manager ingest job start error for %s", manifestPath), ingestJobStartResult.getStartupException());
currentJob.setErrorsOccurred(true); currentJob.setErrorsOccurred(true);
setCaseNodeDataErrorsOccurred(caseDirectoryPath); setCaseNodeDataErrorsOccurred(caseDirectoryPath);
jobLogger.logAnalysisStartupError(); jobLogger.logAnalysisStartupError();
@ -2659,7 +2660,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
} }
} else { } else {
for (String warning : settingsWarnings) { for (String warning : settingsWarnings) {
SYS_LOGGER.log(Level.SEVERE, "Ingest job settings error for {0}: {1}", new Object[]{manifestPath, warning}); sysLogger.log(Level.SEVERE, "Ingest job settings error for {0}: {1}", new Object[]{manifestPath, warning});
} }
currentJob.setErrorsOccurred(true); currentJob.setErrorsOccurred(true);
setCaseNodeDataErrorsOccurred(caseDirectoryPath); setCaseNodeDataErrorsOccurred(caseDirectoryPath);
@ -2732,7 +2733,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private void exportFiles(AutoIngestDataSource dataSource) throws FileExportException, AutoIngestJobLoggerException, InterruptedException, CaseNodeData.InvalidDataException, CoordinationServiceException { private void exportFiles(AutoIngestDataSource dataSource) throws FileExportException, AutoIngestJobLoggerException, InterruptedException, CaseNodeData.InvalidDataException, CoordinationServiceException {
Manifest manifest = currentJob.getManifest(); Manifest manifest = currentJob.getManifest();
Path manifestPath = manifest.getFilePath(); Path manifestPath = manifest.getFilePath();
SYS_LOGGER.log(Level.INFO, "Exporting files for {0}", manifestPath); sysLogger.log(Level.INFO, "Exporting files for {0}", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.EXPORTING_FILES, Date.from(Instant.now())); currentJob.setProcessingStage(AutoIngestJob.Stage.EXPORTING_FILES, Date.from(Instant.now()));
Path caseDirectoryPath = currentJob.getCaseDirectoryPath(); Path caseDirectoryPath = currentJob.getCaseDirectoryPath();
AutoIngestJobLogger jobLogger = new AutoIngestJobLogger(manifestPath, manifest.getDataSourceFileName(), caseDirectoryPath); AutoIngestJobLogger jobLogger = new AutoIngestJobLogger(manifestPath, manifest.getDataSourceFileName(), caseDirectoryPath);
@ -2743,7 +2744,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
jobLogger.logFileExportCompleted(); jobLogger.logFileExportCompleted();
} }
} catch (FileExportException ex) { } catch (FileExportException ex) {
SYS_LOGGER.log(Level.SEVERE, String.format("Error doing file export for %s", manifestPath), ex); sysLogger.log(Level.SEVERE, String.format("Error doing file export for %s", manifestPath), ex);
currentJob.setErrorsOccurred(true); currentJob.setErrorsOccurred(true);
setCaseNodeDataErrorsOccurred(caseDirectoryPath); setCaseNodeDataErrorsOccurred(caseDirectoryPath);
jobLogger.logFileExportError(); jobLogger.logFileExportError();
@ -2916,7 +2917,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private final long MAX_SECONDS_WITHOUT_UPDATE = JOB_STATUS_EVENT_INTERVAL_SECONDS * MAX_MISSED_JOB_STATUS_UPDATES; private final long MAX_SECONDS_WITHOUT_UPDATE = JOB_STATUS_EVENT_INTERVAL_SECONDS * MAX_MISSED_JOB_STATUS_UPDATES;
private PeriodicJobStatusEventTask() { private PeriodicJobStatusEventTask() {
SYS_LOGGER.log(Level.INFO, "Periodic status publishing task started"); sysLogger.log(Level.INFO, "Periodic status publishing task started");
} }
@Override @Override
@ -2949,7 +2950,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try { try {
StatusDatabaseLogger.logToStatusDatabase(message, isError); StatusDatabaseLogger.logToStatusDatabase(message, isError);
} catch (SQLException | UserPreferencesException ex) { } catch (SQLException | UserPreferencesException ex) {
SYS_LOGGER.log(Level.WARNING, "Failed to update status database", ex); sysLogger.log(Level.WARNING, "Failed to update status database", ex);
} }
} }
} }
@ -2975,7 +2976,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
} }
} catch (Exception ex) { } catch (Exception ex) {
SYS_LOGGER.log(Level.SEVERE, "Unexpected exception in PeriodicJobStatusEventTask", ex); //NON-NLS sysLogger.log(Level.SEVERE, "Unexpected exception in PeriodicJobStatusEventTask", ex); //NON-NLS
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2015 Basis Technology Corp. * Copyright 2015-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -25,8 +25,8 @@ import java.sql.Timestamp;
import java.util.logging.FileHandler; import java.util.logging.FileHandler;
import java.util.logging.Formatter; import java.util.logging.Formatter;
import java.util.logging.LogRecord; import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.annotation.concurrent.GuardedBy; import javax.annotation.concurrent.GuardedBy;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
/** /**
@ -37,7 +37,7 @@ final class AutoIngestSystemLogger {
private static final int LOG_SIZE = 50000000; // In bytes, zero is unlimited, set to roughly 10mb currently private static final int LOG_SIZE = 50000000; // In bytes, zero is unlimited, set to roughly 10mb currently
private static final int LOG_FILE_COUNT = 10; private static final int LOG_FILE_COUNT = 10;
private static final Logger LOGGER = Logger.getLogger("AutoIngest"); //NON-NLS private static final Logger logger = Logger.getLogger("AutoIngest"); //NON-NLS
private static final String NEWLINE = System.lineSeparator(); private static final String NEWLINE = System.lineSeparator();
@GuardedBy("AutoIngestSystemLogger") @GuardedBy("AutoIngestSystemLogger")
private static boolean configured; private static boolean configured;
@ -74,14 +74,14 @@ final class AutoIngestSystemLogger {
+ stackTrace; + stackTrace;
} }
}); });
LOGGER.addHandler(fileHandler); logger.addHandler(fileHandler);
LOGGER.setUseParentHandlers(false); logger.setUseParentHandlers(false);
} catch (SecurityException | IOException ex) { } catch (SecurityException | IOException ex) {
throw new RuntimeException(String.format("Error initializing file handler for %s", logFilePath), ex); //NON-NLS throw new RuntimeException(String.format("Error initializing file handler for %s", logFilePath), ex); //NON-NLS
} }
configured = true; configured = true;
} }
return LOGGER; return logger;
} }
/** /**

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2015 Basis Technology Corp. * Copyright 2015-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -26,6 +26,7 @@ import java.sql.Statement;
import java.util.logging.Level; import java.util.logging.Level;
import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.core.UserPreferencesException; import org.sleuthkit.autopsy.core.UserPreferencesException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.NetworkUtils; import org.sleuthkit.autopsy.coreutils.NetworkUtils;
import org.sleuthkit.autopsy.experimental.configuration.AutoIngestUserPreferences; import org.sleuthkit.autopsy.experimental.configuration.AutoIngestUserPreferences;
@ -33,72 +34,79 @@ import org.sleuthkit.autopsy.experimental.configuration.AutoIngestUserPreference
* Write auto-ingest status updates to a database. * Write auto-ingest status updates to a database.
*/ */
public class StatusDatabaseLogger { public class StatusDatabaseLogger {
/** /**
* Log the current status to the database using the database * Log the current status to the database using the database parameters
* parameters saved in AutoIngestUserPreferences. * saved in AutoIngestUserPreferences.
* @param message Current status message *
* @param isError true if we're in an error state, false otherwise * @param message Current status message
* @throws SQLException * @param isError true if we're in an error state, false otherwise
*
* @throws SQLException If a SQL data access error occurs.
* @throws UserPreferencesException If there's an issue reading the user
* preferences.
*/ */
public static void logToStatusDatabase(String message, boolean isError) throws SQLException, UserPreferencesException{ public static void logToStatusDatabase(String message, boolean isError) throws SQLException, UserPreferencesException {
try{ try {
Class.forName("org.postgresql.Driver"); Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException ex){ } catch (ClassNotFoundException ex) {
java.util.logging.Logger SYS_LOGGER = AutoIngestSystemLogger.getLogger(); Logger sysLogger = AutoIngestSystemLogger.getLogger();
SYS_LOGGER.log(Level.WARNING, "Error loading postgresql driver", ex); sysLogger.log(Level.WARNING, "Error loading postgresql driver", ex);
} }
try (Connection connection = DriverManager.getConnection("jdbc:postgresql://" try (Connection connection = DriverManager.getConnection("jdbc:postgresql://"
+ AutoIngestUserPreferences.getLoggingDatabaseHostnameOrIP() + AutoIngestUserPreferences.getLoggingDatabaseHostnameOrIP()
+ ":" + AutoIngestUserPreferences.getLoggingPort() + ":" + AutoIngestUserPreferences.getLoggingPort()
+ "/" + AutoIngestUserPreferences.getLoggingDatabaseName(), + "/" + AutoIngestUserPreferences.getLoggingDatabaseName(),
AutoIngestUserPreferences.getLoggingUsername(), AutoIngestUserPreferences.getLoggingUsername(),
AutoIngestUserPreferences.getLoggingPassword()); AutoIngestUserPreferences.getLoggingPassword());
Statement statement = connection.createStatement();) { Statement statement = connection.createStatement();) {
logToStatusDatabase(statement, message, isError); logToStatusDatabase(statement, message, isError);
} }
} }
/** /**
* Log the current status to the database using an already * Log the current status to the database using an already configured
* configured Statement. * Statement.
*
* @param statement SQL statement (must have already been created) * @param statement SQL statement (must have already been created)
* @param message Current status message * @param message Current status message
* @param isError true if we're in an error state, false otherwise * @param isError true if we're in an error state, false otherwise
* @throws SQLException *
* @throws SQLException
*/ */
public static void logToStatusDatabase(Statement statement, String message, boolean isError) throws SQLException{ public static void logToStatusDatabase(Statement statement, String message, boolean isError) throws SQLException {
if((statement == null) || statement.isClosed()){ if ((statement == null) || statement.isClosed()) {
throw new SQLException("SQL Statement is null/closed"); throw new SQLException("SQL Statement is null/closed");
} }
int status; int status;
if(isError){ if (isError) {
status = 1; status = 1;
} else { } else {
status = 0; status = 0;
} }
String timestamp = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date()); String timestamp = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format( new java.util.Date());
String checkForPreviousEntry = "SELECT * FROM statusUpdates WHERE tool='" + UserPreferences.getAppName() + "' AND " + String checkForPreviousEntry = "SELECT * FROM statusUpdates WHERE tool='" + UserPreferences.getAppName() + "' AND "
"node='" + NetworkUtils.getLocalHostName() + "'"; + "node='" + NetworkUtils.getLocalHostName() + "'";
ResultSet resultSet = statement.executeQuery(checkForPreviousEntry); ResultSet resultSet = statement.executeQuery(checkForPreviousEntry);
String logMessage; String logMessage;
if(resultSet.next()){ if (resultSet.next()) {
logMessage = "UPDATE statusUpdates SET reportTime='" + timestamp + logMessage = "UPDATE statusUpdates SET reportTime='" + timestamp
"', message='" + message + "', status=" + status + "', message='" + message + "', status=" + status
+ " WHERE tool='" + UserPreferences.getAppName() + "' AND node='" + NetworkUtils.getLocalHostName() + "'"; + " WHERE tool='" + UserPreferences.getAppName() + "' AND node='" + NetworkUtils.getLocalHostName() + "'";
} else { } else {
logMessage = "INSERT INTO statusUpdates (tool, node, reportTime, message, status) " + logMessage = "INSERT INTO statusUpdates (tool, node, reportTime, message, status) "
"VALUES ('" + UserPreferences.getAppName() + "VALUES ('" + UserPreferences.getAppName()
+ "', '" + NetworkUtils.getLocalHostName() + + "', '" + NetworkUtils.getLocalHostName()
"', '" + + "', '"
timestamp + "', '" + message + "', '" + status + "')"; + timestamp + "', '" + message + "', '" + status + "')";
} }
statement.execute(logMessage); statement.execute(logMessage);
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2017 Basis Technology Corp. * Copyright 2011-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -39,7 +39,7 @@ public class KeywordSearch {
private static Server server; private static Server server;
//we want a custom java.util.logging.Logger here for a reason //we want a custom java.util.logging.Logger here for a reason
//a separate logger from framework logs //a separate logger from framework logs
private static final Logger TIKA_LOGGER = Logger.getLogger("Tika"); //NON-NLS private static final Logger tikaLogger = Logger.getLogger("Tika"); //NON-NLS
private static final org.sleuthkit.autopsy.coreutils.Logger logger = org.sleuthkit.autopsy.coreutils.Logger.getLogger(Case.class.getName()); private static final org.sleuthkit.autopsy.coreutils.Logger logger = org.sleuthkit.autopsy.coreutils.Logger.getLogger(Case.class.getName());
// @@@ We should move this into TskData (or somewhere) because we are using // @@@ We should move this into TskData (or somewhere) because we are using
@ -70,9 +70,9 @@ public class KeywordSearch {
0, MAX_TIKA_LOG_FILES); 0, MAX_TIKA_LOG_FILES);
tikaLogHandler.setFormatter(new SimpleFormatter()); tikaLogHandler.setFormatter(new SimpleFormatter());
tikaLogHandler.setEncoding(PlatformUtil.getLogFileEncoding()); tikaLogHandler.setEncoding(PlatformUtil.getLogFileEncoding());
TIKA_LOGGER.addHandler(tikaLogHandler); tikaLogger.addHandler(tikaLogHandler);
//do not forward to the parent autopsy logger //do not forward to the parent autopsy logger
TIKA_LOGGER.setUseParentHandlers(false); tikaLogger.setUseParentHandlers(false);
} catch (IOException | SecurityException ex) { } catch (IOException | SecurityException ex) {
logger.log(Level.SEVERE, "Error setting up tika logging", ex); //NON-NLS logger.log(Level.SEVERE, "Error setting up tika logging", ex); //NON-NLS
} }
@ -84,7 +84,7 @@ public class KeywordSearch {
} }
static Logger getTikaLogger() { static Logger getTikaLogger() {
return TIKA_LOGGER; return tikaLogger;
} }
public static void addNumIndexedFilesChangeListener(PropertyChangeListener l) { public static void addNumIndexedFilesChangeListener(PropertyChangeListener l) {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2017 Basis Technology Corp. * Copyright 2011-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -32,7 +32,6 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.text.JTextComponent; import javax.swing.text.JTextComponent;
@ -58,6 +57,7 @@ import org.netbeans.jemmy.operators.JTreeOperator;
import org.netbeans.jemmy.operators.JTreeOperator.NoSuchPathException; import org.netbeans.jemmy.operators.JTreeOperator.NoSuchPathException;
import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.core.UserPreferencesException; import org.sleuthkit.autopsy.core.UserPreferencesException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.events.MessageServiceConnectionInfo; import org.sleuthkit.autopsy.events.MessageServiceConnectionInfo;
import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.datamodel.CaseDbConnectionInfo; import org.sleuthkit.datamodel.CaseDbConnectionInfo;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2017 Basis Technology Corp. * Copyright 2011-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -20,11 +20,11 @@ package org.sleuthkit.autopsy.testing;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.logging.Logger;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.netbeans.jemmy.Timeouts; import org.netbeans.jemmy.Timeouts;
import org.netbeans.junit.NbModuleSuite; import org.netbeans.junit.NbModuleSuite;
import org.sleuthkit.autopsy.coreutils.Logger;
/** /**
* This test expects the following system properties to be set: img_path: The * This test expects the following system properties to be set: img_path: The
@ -41,7 +41,7 @@ import org.netbeans.junit.NbModuleSuite;
public class RegressionTest extends TestCase { public class RegressionTest extends TestCase {
private static final Logger logger = Logger.getLogger(RegressionTest.class.getName()); private static final Logger logger = Logger.getLogger(RegressionTest.class.getName());
private static AutopsyTestCases autopsyTests = new AutopsyTestCases(Boolean.parseBoolean(System.getProperty("isMultiUser"))); private static final AutopsyTestCases autopsyTests = new AutopsyTestCases(Boolean.parseBoolean(System.getProperty("isMultiUser")));
/** /**
* Constructor required by JUnit * Constructor required by JUnit