APISonar


org.sleuthkit.autopsy.coreutils.Logger.log

> org > sleuthkit > autopsy > coreutils > Logger > log
org APIs sleuthkit APIs autopsy APIs coreutils APIs Logger APIs log APIs

Example 1
private final Logger logger = Logger.getLogger(IngestMonitor.class.getName());

    IngestMonitor() {
        /*
         * Setup a separate memory usage logger.
         */
        try {
            FileHandler monitorLogHandler = new FileHandler(PlatformUtil.getUserDirectory().getAbsolutePath() + "/var/log/monitor.log", 0, MAX_LOG_FILES); //NON-NLS
            monitorLogHandler.setFormatter(new SimpleFormatter());
            monitorLogHandler.setEncoding(PlatformUtil.getLogFileEncoding());
            monitorLogger.setUseParentHandlers(false);
            monitorLogger.addHandler(monitorLogHandler);
        } catch (IOException | SecurityException ex) {
            logger.log(Level.SEVERE, "Failed to create memory usage logger", ex); //NON-NLS
        }
    }
Example 2
static final Logger logger = Logger.getLogger(TestLogger.class.getName());

    public void actionPerformed(ActionEvent e) {

        logger.log(Level.WARNING, "Testing log!", new Exception(new Exception(new Exception(new Exception("original reason with asdfasdfasdfasdfasd fasdfasdfasdf sdfasdfasdfa asdfasdf asdfa sdfas ", new Exception("more original reason")))))); //NON-NLS
        //throw new RuntimeException("othe");

        //logger.log(Level.WARNING, "Testing log!");
    }
Example 3
private static final Logger logger = Logger.getLogger(Installer.class.getName());

    public void validate() throws IllegalStateException {
        super.validate();

        logger.log(Level.INFO, "validate()");
        for (ModuleInstall mi : packageInstallers) {
            logger.log(Level.INFO, mi.getClass().getName() + " validate()");
            try {
                mi.validate();
            } catch (Exception e) {
                logger.log(Level.WARNING, "", e);
            }
        }
    }
Example 4
private static final Logger logger = Logger.getLogger(GoogleTranslator.class.getName());

    private static boolean googleIsReachable() {
        String host = "www.google.com";
        InetAddress address;
        try {
            address = InetAddress.getByName(host);
            return address.isReachable(1500);
        } catch (UnknownHostException ex) {
            logger.log(Level.WARNING, "Unable to reach google.com due to unknown host", ex);
            return false;
        } catch (IOException ex) {
            logger.log(Level.WARNING, "Unable to reach google.com due IOException", ex);
            return false;
        }
    }
Example 5
private static final Logger logger = Logger.getLogger(ReportXLS.class.getName());

    public void getPreview(String path) {
        File file = new File(path);
        try {
            Desktop.getDesktop().open(file);
        } catch (IOException e) {
            logger.log(Level.WARNING, "Could not open XLS report! ", e);
        }
    }
Example 6
private static final Logger logger = Logger.getLogger(IngestModuleLoader.class.getName());

    private IngestModuleAbstract getNewIngestModuleInstance(Class<IngestModuleAbstract> moduleClass) {
        try {
            IngestModuleAbstract newInstance = moduleClass.newInstance();
            return newInstance;
        } catch (InstantiationException e) {
            logger.log(Level.SEVERE, "Cannot instantiate module: " + moduleClass.getName(), e);
            return null;
        } catch (IllegalAccessException e) {
            logger.log(Level.SEVERE, "Cannot instantiate module: " + moduleClass.getName(), e);
            return null;
        }

    }
Example 7
private static final Logger logger = Logger.getLogger(AutopsyOptionsPanel.class.getName());

    private static List<String> readConfFile(File configFile) {
        List<String> lines = new ArrayList<>();
        if (null != configFile) {
            Path filePath = configFile.toPath();
            Charset charset = Charset.forName("UTF-8");
            try {
                lines = Files.readAllLines(filePath, charset);
            } catch (IOException e) {
                logger.log(Level.SEVERE, "Error reading config file contents. {}", configFile.getAbsolutePath());
            }
        }
        return lines;
    }
Example 8
private final static Logger LOGGER = Logger.getLogger(SqliteEamDbSettings.class.getName());

    public boolean createDbDirectory() {
        if (!dbDirectoryExists()) {
            try {
                File dbDir = new File(getDbDirectory());
                Files.createDirectories(dbDir.toPath());
                LOGGER.log(Level.INFO, "sqlite directory did not exist, created it at {0}.", getDbDirectory()); // NON-NLS
            } catch (IOException | InvalidPathException | SecurityException ex) {
                LOGGER.log(Level.SEVERE, "Failed to create sqlite database directory.", ex); // NON-NLS
                return false;
            }
        }

        return true;
    }
Example 9
private static final Logger logger = Logger.getLogger(KeywordSearchIngestModule.class.getName());

    private void commit() {
        if (initialized) {
            logger.log(Level.INFO, "Commiting index");
            ingester.commit();
            logger.log(Level.INFO, "Index comitted");
            //signal a potential change in number of indexed files
            indexChangeNotify();
        }
    }
Example 10
private static final Logger logger = Logger.getLogger(DrawableDB.class.getName());

    public Set<String> getHashSetNames() {
        Set<String> names = new HashSet<>();
        // "SELECT DISTINCT hash_set_name FROM hash_sets"
        dbWriteLock();
        try (ResultSet rs = selectHashSetNamesStmt.executeQuery();) {
            while (rs.next()) {
                names.add(rs.getString("hash_set_name"));
            }
        } catch (SQLException sQLException) {
            logger.log(Level.WARNING, "failed to get hash set names", sQLException); //NON-NLS
        } finally {
            dbWriteUnlock();
        }
        return names;
    }
Example 11
private static final Logger logger = Logger.getLogger(DataSourceSingleValueCallback.class.getName());

    public void process(ResultSet rs) {
        try {
            while (rs.next()) {
                try {
                    dataSourceObjIdValues.put(rs.getLong("data_source_obj_id"), rs.getLong("value"));
                } catch (SQLException ex) {
                    logger.log(Level.WARNING, "Unable to get data_source_obj_id or value from result set", ex);
                }
            }
        } catch (SQLException ex) {
            logger.log(Level.WARNING, "Failed to get next result for valuess by datasource", ex);
        }
    }
Example 12
private static final Logger logger = Logger.getLogger(AbstractDataResultViewer.class.getName());

    public void setSelectedNodes(Node[] selected) {
        try {
            this.em.setSelectedNodes(selected);
        } catch (PropertyVetoException ex) {
            logger.log(Level.WARNING, "Couldn't set selected nodes.", ex);
        }
    }
Example 13
private static final Logger logger = Logger.getLogger(EscapeUtil.class.getName());

    public static String encodeURL(String url) {
        try {
            return URLEncoder.encode(url, "UTF-8");
        } catch (UnsupportedEncodingException ex) {
            logger.log(Level.SEVERE, "Could not encode URL " + url, ex);
            //should not happen
            return "";
        }
    }
Example 14
private static final Logger sysLogger = AutoIngestSystemLogger.getLogger();

    void scanInputDirsAndWait() {
        if (State.RUNNING != state) {
            return;
        }
        sysLogger.log(Level.INFO, "Starting input scan of {0}", rootInputDirectory);
        InputDirScanner scanner = new InputDirScanner();

        scanner.scan();
        sysLogger.log(Level.INFO, "Completed input scan of {0}", rootInputDirectory);
    }
Example 15
private static final Logger logger = Logger.getLogger(InterestingItemsFilesSetSettings.class.getName());

    private static Pattern compileRegex(String regex) {
        try {
            return Pattern.compile(regex);
        } catch (PatternSyntaxException ex) {
            logger.log(Level.SEVERE, "Error compiling rule regex: " + ex.getMessage(), ex); // NON-NLS
            return null;
        }
    }
Example 16
private static final Logger logger = Logger.getLogger(OpenAutoIngestLogAction.class.getName());

    public void actionPerformed(ActionEvent event) {
        try {
            if (caseAutoIngestLogFilePath.toFile().exists()) {
                Desktop.getDesktop().edit(caseAutoIngestLogFilePath.toFile());
            } else {
                MessageNotifyUtil.Message.error(Bundle.OpenAutoIngestLogAction_deletedLogErrorMsg());
            }
        } catch (IOException ex) {
            logger.log(Level.SEVERE, String.format("Error opening case auto ingest log file at %s", caseAutoIngestLogFilePath), ex); //NON-NLS
            MessageNotifyUtil.Message.error(Bundle.OpenAutoIngestLogAction_logOpenFailedErrorMsg());
        }
    }
Example 17
private static final Logger sysLogger = AutoIngestSystemLogger.getLogger();

    void cancelCurrentJob() {
        if (State.RUNNING != state) {
            return;
        }
        synchronized (jobsLock) {
            if (null != currentJob) {
                currentJob.cancel();
                sysLogger.log(Level.INFO, "Cancelling automated ingest for manifest {0}", currentJob.getManifest().getFilePath());
            }
        }
    }
Example 18
private static final Logger logger = Logger.getLogger(DropdownSingleTermSearchPanel.class.getName());

    private void keywordTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keywordTextFieldActionPerformed
        try {
            search();
        } catch (Exception e) {
            logger.log(Level.SEVERE, "search() threw exception", e); //NON-NLS
        }
    }//GEN-LAST:event_keywordTextFieldActionPerformed
Example 19
private static final Logger logger = Logger.getLogger(FileExporterSettingsPanel.class.getName());

    void populateMimeTypes() {
        try {
            SortedSet<String> detectableMimeTypes = FileTypeDetector.getDetectedTypes();
            detectableMimeTypes.addAll(scanRulesForMimetypes());
            detectableMimeTypes.forEach((type) -> {
                comboBoxMimeValue.addItem(type);
            });
        } catch (FileTypeDetector.FileTypeDetectorInitException ex) {
            logger.log(Level.SEVERE, "Unable to get detectable file types", ex);
        }
    }
Example 20
private static final Logger logger = Logger.getLogger(TangoMessageAnalyzer.class.getName());

    private static String decodeMessage(String wrapper, String message) {
        String result = "";
        byte[] decoded = Base64.decodeBase64(message);
        try {
            String Z = new String(decoded, "UTF-8");
            result = Z.split(wrapper)[1];
        } catch (Exception e) {
            logger.log(Level.SEVERE, "Error decoding a Tango message", e); //NON-NLS
        }
        return result;
    }
Example 21
private static final Logger logger = Logger.getLogger(ReportHTML.class.getName());

    public void addSetElement(String elementName) {
        try {
            out.write("<h4>" + elementName + "</h4>\n"); //NON-NLS
        } catch (IOException ex) {
            logger.log(Level.SEVERE, "Failed to write set element: {0}", ex); //NON-NLS
        }
    }
Example 22
private final Logger logger = Logger.getLogger(IngestMonitor.class.getName());

    long getFreeSpace() {
        try {
            return timerAction.getFreeSpace();
        } catch (SecurityException e) {
            logger.log(Level.WARNING, "Error checking for free disk space on ingest data drive", e); //NON-NLS
            return DISK_FREE_SPACE_UNKNOWN;
        }
    }
Example 23
private static final Logger logger = Logger.getLogger(ExternalResultsXMLParser.class.getName());

    private String getElementAttributeValue(Element element, String attributeName) {
        final String attributeValue = element.getAttribute(attributeName);
        if (attributeValue.isEmpty()) {
            logger.log(Level.SEVERE, "Found {0} element missing {1} attribute in {2}", new Object[]{ //NON-NLS
                element.getTagName(),
                attributeName,
                this.resultsFilePath});
        }
        return attributeValue;
    }
Example 24
private static final Logger logger = Logger.getLogger(CasePreferences.class.getName());

    private static void saveToStorage(Case currentCase) {
        Path settingsFile = Paths.get(currentCase.getConfigDirectory(), SETTINGS_FILE); //NON-NLS
        Properties props = new Properties();
        if (groupItemsInTreeByDataSource != null) {
            props.setProperty(KEY_GROUP_BY_DATA_SOURCE, (groupItemsInTreeByDataSource ? VALUE_TRUE : VALUE_FALSE));
        }

        try (OutputStream fos = Files.newOutputStream(settingsFile)) {
            props.store(fos, ""); //NON-NLS
        } catch (IOException ex) {
            logger.log(Level.SEVERE, "Error writing settings file", ex);
        }
    }
Example 25
public final Logger logger = Logger.getLogger(this.getClass().getName());

    public List<HashMap<String,Object>> dbConnect(String path, String query) {
        ResultSet temprs = null;
        List<HashMap<String,Object>> list = new ArrayList<HashMap<String,Object>>();
        String connectionString = "jdbc:sqlite:" + path;
        try {
            SQLiteDBConnect tempdbconnect = new SQLiteDBConnect("org.sqlite.JDBC", connectionString);
            temprs = tempdbconnect.executeQry(query);
            list = this.resultSetToArrayList(temprs);
            tempdbconnect.closeConnection();
        } catch (Exception ex) {
            logger.log(Level.SEVERE, "Error while trying to read into a sqlite db." + connectionString, ex);
            return new ArrayList<HashMap<String,Object>>();
        }
        return list;
    }