Go to the documentation of this file.
19package org.sleuthkit.autopsy.exceptions;
21import java.util.logging.Filter;
22import java.util.logging.Handler;
23import java.util.logging.Level;
24import java.util.logging.LogRecord;
25import java.util.logging.SimpleFormatter;
26import javax.swing.JOptionPane;
27import org.openide.util.lookup.ServiceProvider;
28import org.netbeans.core.NbErrorManager;
29import org.sleuthkit.autopsy.coreutils.Logger;
30import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
31import org.sleuthkit.autopsy.coreutils.Version;
36@ServiceProvider(service = Handler.class, supersedes =
"org.netbeans.core.NbErrorManager")
39 static final int INFO_VALUE = Level.INFO.intValue();
40 static final int WARNING_VALUE = Level.WARNING.intValue();
41 static final int SEVERE_VALUE = Level.SEVERE.intValue();
42 static final Handler nbErrorManager =
new NbErrorManager();
49 this.setLevel(Level.SEVERE);
59 this.setFormatter(
new SimpleFormatter());
65 if (isLoggable(record)) {
69 if (record.getMessage() !=
null) {
72 logger.log(Level.SEVERE,
"Unexpected error: " + title +
", " + message);
75 nbErrorManager.publish(record);
88 return record.getThrown() !=
null;
101 final String logMessage = getFormatter().formatMessage(record);
102 String explanation = record.getThrown().getMessage();
103 String causeMessage = (explanation !=
null) ?
"\nCaused by: " + explanation :
"";
105 return logMessage + causeMessage;
122 if (levelValue >= SEVERE_VALUE) {
123 return JOptionPane.ERROR_MESSAGE;
124 }
else if (levelValue >= WARNING_VALUE) {
125 return JOptionPane.WARNING_MESSAGE;
127 return JOptionPane.INFORMATION_MESSAGE;
132 if (levelValue >= SEVERE_VALUE) {
134 }
else if (levelValue >= WARNING_VALUE) {
147 public void close() throws SecurityException {
synchronized static Logger getLogger(String name)
static void error(String title, String message)
static Version.Type getBuildType()
boolean isLoggable(LogRecord record)
static int getMessageTypeForLevelValue(int levelValue)
AutopsyExceptionHandler()
void publish(LogRecord record)
String formatExplanation(LogRecord record)
static String getTitleForLevelValue(int levelValue)
Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 United States License.