Closed reprogrammer closed 13 years ago
Currently, we are capturing the refactoring exceptions onto System.err
( See 1c846c782e045dd0772fb91bba4a28a16ddb8401 .. d8317781ba131ceda94396d58050ef5b52bb3b5f for more details). We need to resolve issue #149 in order to store the errors in the watched directory,
Used SafeRecorder instead of System.out in 057ed5bb54caa3bc8b775e33f9ac7918dfa79f47.
Has this issue been completed? I noticed that an errorlog.txt file is uploaded to the SVN server.
This issue hasn't been resolved yet. CodingSpectator captures some information about errors, but it needs to capture more using the Eclipse standard format for reporting errors.
Fixed the format of the error log in feab4741ed8fe5d7e500189de78f31278f80f367. I tested the error log by triggering the problem described in issue #22.
3687f163f8b5b0fb41d3242a6533b78d12291752 fixed the error log to by listening to Platform
in order to capture all errors.
We noticed that are problems with what CodingSpectator captures when a refactoring throws an exception (See issue #22 for more details.). And, it seems fairly complicated to correctly capture the message and the type of refactoring (cancelled or performed) when an exception gets thrown. But, whenever a refactoring throws an exception, the exception gets added to the error log. So, if we capture the error log, we can validate the data captured by CodingSpectator. For example, if an invocation of a pull up refactoring throws an exception, we can look for an error in the error log with a close timestamp.
Fortunately, Eclipse provides a listener for the underlying log object of the error log view. To capture the errors submitted to the error log, we can add a listener to the underlying log object. The underlying log object is of type
ILog
, and we can get a reference to it by the expressionRefactoringUIPlugin.getDefault().getLog()
. To add a listener to this log object, we need to invoke the methodorg.eclipse.core.runtime.ILog.addLogListener(ILogListener)
and provide it aILogListener
. The listener object gets notified whenever somethings gets added to the error log. Every time the listener object gets notified, CodingSpectator appends the error to a file in its watched directory (${ECLIPSE_WORKSPACE}/.metadata/.plugins/org.eclipse.ltk.core.refactoring/
).Refer to Platform UI Error Handling for more information about error handling in Eclipse.