import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
public static final String OPTION_ID_PERFORM = "org.tizen.common.logger.perform";
private static final int DEFAULT_LEVEL = 1;
- private static final Level[] LEVELS = {Level.OFF, Level.FATAL, Level.ERROR, Level.WARNING, Level.INFO, Level.DEBUG, Level.TRACE, Level.ALL};
+ private static final Level[] LEVELS = {Level.OFF, Level.ERROR, Level.INFO, Level.DEBUG, Level.ALL};
private Text loggerCP;
private Text loggerLocText;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.spi.LoggingEvent;
import org.apache.log4j.spi.ThrowableInformation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.tizen.common.CommonPlugin;
+import org.tizen.common.ui.view.console.ConsoleManager;
/**
* appends log to the Eclipse error log view
* @author Ho Namkoong {@literal <ho.namkoong@samsung.com>} (S-Core)
*/
@Override
- protected void append(LoggingEvent arg0) {
+ protected void append(LoggingEvent event) {
try {
- int level = arg0.getLevel().toInt();
- ThrowableInformation tI = arg0.getThrowableInformation();
+ Level level = event.getLevel();
+ ThrowableInformation tI = event.getThrowableInformation();
Throwable t = null;
if(tI != null) {
t = tI.getThrowable();
}
- String message = getLayout().format(arg0);
+ String message = getLayout().format(event);
+ String caller = event.getLocationInformation().getClassName();
- switch (level) {
- case Level.ERROR_INT:
- Logger.error(message, t);
- break;
- case Level.WARN_INT:
- Logger.warning(message, t);
- break;
- case Level.DEBUG_INT:
- Logger.debug(message, t);
- break;
- case Level.FATAL_INT:
- Logger.error(message, t);
- break;
- case Level.INFO_INT:
- Logger.info(message, t);
- break;
- default:
- break;
+ if(level.isGreaterOrEqual(Level.OFF)) {
+ return;
+ }
+ if(level.isGreaterOrEqual(Level.ERROR)) {
+ log(new Status(Status.ERROR, caller, message.toString(), t));
+ }
+ else if(level.isGreaterOrEqual(Level.WARN)) {
+ log(new Status(Status.WARNING, caller, message.toString(), t));
+ }
+ else if(level.isGreaterOrEqual(Level.INFO)) {
+ log(new Status(Status.INFO, caller, message.toString(), t));
}
}
catch(Throwable t) {
- LogLog.error(MessageFormat.format("Exception occurred while logging message: {0}", arg0.getMessage()), t);
+ LogLog.error(MessageFormat.format("Exception occurred while logging message: {0}", event.getMessage()), t);
+ }
+ }
+
+
+ private static void log(IStatus status) {
+ CommonPlugin plugin = CommonPlugin.getDefault();
+ if (plugin != null) {
+ plugin.getLog().log(status);
+ } else {
+ ConsoleManager conManager = new ConsoleManager("Error Log", false);
+ conManager.println(status.getPlugin() + " : " + status.getMessage());
}
}
}
public static final Level OFF = new Level(org.apache.log4j.Level.OFF, Messages.LOGGER_OFF_DES);
/**
- * Logging level fatal
- */
- public static final Level FATAL = new Level(org.apache.log4j.Level.FATAL, Messages.LOGGER_FATAL_DES);
-
- /**
* Logging level error
*/
public static final Level ERROR = new Level(org.apache.log4j.Level.ERROR, Messages.LOGGER_ERROR_DES);
/**
- * Logging level warning
- */
- public static final Level WARNING = new Level(org.apache.log4j.Level.WARN, Messages.LOGGER_WARNING_DES);
-
- /**
* Logging level info
*/
public static final Level INFO = new Level(org.apache.log4j.Level.INFO, Messages.LOGGER_INFO_DES);
public static final Level DEBUG = new Level(org.apache.log4j.Level.DEBUG, Messages.LOGGER_DEBUG_DES);
/**
- * Logging level trace
- */
- public static final Level TRACE = new Level(org.apache.log4j.Level.TRACE, Messages.LOGGER_TRACE_DES);
-
- /**
* Logging level all
*/
public static final Level ALL = new Level(org.apache.log4j.Level.ALL, Messages.LOGGER_ALL_DES);
FileAppender_EXCEPTION_FLUSHING_BUFFER=Exception occurred while flushing buffer.
FileAppender_EXCEPTION_WRITING_LOG=Exception occurred while writing log message.
FileAppender_EXCEPTION_DIRECTORY_EXISTING=Log File {0} already exists as a directory.
-LOGGER_FATAL_DES=FATAL: very severe error events that will presumably lead the application to abort
-LOGGER_TRACE_DES=TRACE: finer-grained informational events than the DEBUG
LOGGER_OFF_DES=OFF: the highest possible rank and is intended to turn off logging
LOGGER_ERROR_DES=ERROR: error events that might still allow the application to continue running
-LOGGER_WARNING_DES=WARNING: events that are potentially harmful situations
LOGGER_INFO_DES=INFO: informational messages that highlight the progress of the application at coarse-grained level
LOGGER_DEBUG_DES=DEBUG: fine-grained informational events that are most useful to debug an application
LOGGER_ALL_DES=ALL: the lowest possible rank and is intended to turn on all logging