19 package org.sleuthkit.autopsy.keywordsearch;
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.beans.PropertyChangeSupport;
24 import java.io.IOException;
25 import java.util.logging.FileHandler;
26 import java.util.logging.Level;
27 import java.util.logging.Logger;
28 import java.util.logging.SimpleFormatter;
29 import org.openide.util.NbBundle;
69 final int MAX_TIKA_LOG_FILES = 3;
71 0, MAX_TIKA_LOG_FILES);
72 tikaLogHandler.setFormatter(
new SimpleFormatter());
74 TIKA_LOGGER.addHandler(tikaLogHandler);
76 TIKA_LOGGER.setUseParentHandlers(
false);
77 }
catch (IOException | SecurityException ex) {
78 logger.log(Level.SEVERE,
"Error setting up tika logging", ex);
84 throw new AssertionError();
87 static Logger getTikaLogger() {
92 changeSupport.addPropertyChangeListener(NUM_FILES_CHANGE_EVT, l);
96 changeSupport.removePropertyChangeListener(l);
102 changeSupport.firePropertyChange(NUM_FILES_CHANGE_EVT, oldNum, newNum);
103 }
catch (Exception e) {
104 logger.log(Level.SEVERE,
"KeywordSearch listener threw exception", e);
107 "KeywordSearch.fireNumIdxFileChg.moduleErr.msg"),
115 static class CaseChangeListener
implements PropertyChangeListener {
118 public void propertyChange(PropertyChangeEvent evt) {
120 if (null != evt.getOldValue()) {
121 Case closedCase = (
Case) evt.getOldValue();
123 BlackboardResultWriter.stopAllWriters();
126 }
catch (Exception ex) {
127 String caseName = closedCase.
getName();
128 logger.log(Level.SEVERE, String.format(
"Failed to close core for %s", caseName), ex);
129 MessageNotifyUtil.Notify.error(NbBundle.getMessage(
KeywordSearch.class,
"KeywordSearch.closeCore.notification.msg"), ex.getMessage());
132 if (null != evt.getNewValue()) {
133 Case openedCase = (Case) evt.getNewValue();
135 server.openCoreForCase(openedCase);
136 }
catch (Exception ex) {
137 String caseName = openedCase.getName();
138 logger.log(Level.SEVERE, String.format(
"Failed to open or create core for %s", caseName), ex);
139 MessageNotifyUtil.Notify.error(NbBundle.getMessage(
KeywordSearch.class,
"KeywordSearch.openCore.notification.msg"), ex.getMessage());
static final org.sleuthkit.autopsy.coreutils.Logger logger
static void fireNumIndexedFilesChange(Integer oldNum, Integer newNum)
static void addNumIndexedFilesChangeListener(PropertyChangeListener l)
static synchronized Server getServer()
static PropertyChangeSupport changeSupport
static final Logger TIKA_LOGGER
static final String NUM_FILES_CHANGE_EVT
static void removeNumIndexedFilesChangeListener(PropertyChangeListener l)
synchronized static Logger getLogger(String name)
static void show(String title, String message, MessageType type, ActionListener actionListener)