Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 135531

Summary: No error message when importing the wrong log file type
Product: z_Archived Reporter: Hendra Suwanda <suwanda>
Component: TPTP.monitoringAssignee: Cindy Jin <jx_china>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: jacalcat, nmehrega, smith
Version: unspecifiedKeywords: plan
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 177650    
Attachments:
Description Flags
patch file
none
patch file
none
patch file for JavaLoggingXMLLogParser none

Description Hendra Suwanda CLA 2006-04-07 09:32:17 EDT
Usability problem.

I specified CBE XML log type when importing a log file, but by mistake gave Apache access log file instead.  No error was indicated and 0 log record was displayed.
Comment 1 Dave Smith CLA 2006-04-10 12:08:15 EDT
This problem has been reported in the past but GLA has no support for validating that a log file to be imported is of the correct type.  However, if no records are parsed we can change GLA to issue a warning message that the log file may be empty or of the wrong type.

We'll try to do this in iteration 3 but it has low priority.
Comment 2 Dave Smith CLA 2006-06-05 10:42:38 EDT
Deferred to 4.3 as it is not a stop ship issue for 4.2 and not a regression.
Comment 3 Dave Smith CLA 2006-10-03 23:42:25 EDT
*** Bug 159528 has been marked as a duplicate of this bug. ***
Comment 4 Navid Mehregani CLA 2006-10-04 12:20:10 EDT
Just my 2 cents...
I don't think this should be treated as a low priority item.  If we're running into this problem, I'm sure other users are experiencing it as well.  It's almost impossible for a first time user to figure what they've done wrong when they come across this problem.
Comment 5 Dave Smith CLA 2006-10-20 18:39:09 EDT
Cannot be contained in 4.3 - deferring to 4.4.  Increasing priority so it is addressed early in 4.4.
Comment 6 Dave Smith CLA 2007-01-17 23:25:34 EST
Added sizing.
Comment 7 Dave Smith CLA 2007-02-06 01:42:50 EST
Assigning to Cindy and targetting i2
Comment 8 Cindy Jin CLA 2007-03-13 11:00:18 EDT
Created attachment 60669 [details]
patch file

propsed fix. At BasicContext stop method,check if the sesonr component's itemProcessed counter is bigger than 0, but the outputter component's itemProcessed counter is 0. An error message is logged, " IWAT0812I Zero log record is parsed, it maybe a wrong type of log."
Comment 9 Cindy Jin CLA 2007-03-13 11:02:42 EDT
Dave, Please review the propsed fix. 
Thanks
Comment 10 Dave Smith CLA 2007-03-22 02:23:09 EDT
I have committed the new message to CVS but I changed the wording slightly to the following to be more descriptive to the GLA user:

INVALID_LOG_TYPE_INFO_ = IWAT0812I No log records were parsed. Ensure the log you are parsing is of the expected type.

I did not commit the rest of the patch because it doesn't cover all of the cases.  It doesn't cover the static parser case where the sensor returns no CommonBaseEvent objects. It also doesn't take into consideration the case of filtering where no records match the filter.  We don't want to return this error message if the filter blade is present.  I think the fix should check the if the Parser component returns any objects instead of the Outputter in the case of a rules-based adapter.

Thinking about this problem further from a Log Import user perspective the message shown to the user should refer to importing a log and not parsing a log but GLA does not know it is being called during a log import operation.  Therefore, I think the Log Import service needs to catch this new GLA message and issue its own log import specific message instead.  A separate defect will be opened against the log import service for that change.
Comment 11 Dave Smith CLA 2007-04-03 13:22:05 EDT
Deferring to iteration 3.
Comment 12 Dave Smith CLA 2007-04-16 12:36:44 EDT
There is a Log View defect open for this same problem.  It can be used to add an appropriate message in the Log Import UI when the GLA returns IWAT0812I.
Comment 13 Dave Smith CLA 2007-04-25 13:26:39 EDT
The static parser case will be handled by the static parser classes themselves.  The static parser classes will check whether any records were parsed from the log file.  The Apache access and error log static parsers already do this.  I checked in a fix to org.eclipse.hyades.logging.parsers.JavaLoggingXMLLogParser to add this check and throw an exception with the existing message HyadesGABufferedPeriodicReader_No_Records_Read_ERROR_.

The fix for rules parsers will have to ensure it only applies to rules adapters.  It should also not apply to the case where sensor or extractor filtering is used and as mentioned earlier should handle the case where a filter blade is used.
Comment 14 Cindy Jin CLA 2007-04-27 17:25:58 EDT
Created attachment 65274 [details]
patch file
Comment 15 Cindy Jin CLA 2007-04-27 17:30:59 EDT
Created attachment 65276 [details]
patch file for JavaLoggingXMLLogParser
Comment 16 Dave Smith CLA 2007-05-04 03:59:00 EDT
Committed fix to TPTP head CVS. Made some small changes to org.eclipse.hyades.logging.adapter patch that is attached.  The following files were changed:

BasicContext.java - in addition to the patch, also added a check for extractor filtering
CBEFormatter.java - changed the items processed counter to only count valid CBE's that are cresated
Adapter.java - updated some of the javadoc
LocalLogImportCBEFormatter.java - changed counter printed in trace statement.
Comment 17 Hendra Suwanda CLA 2007-05-08 09:31:56 EDT
Two comments from usability point of view:

1. The error message is intended for the programmer (not for the end-user). It says something about "parsing error" (not very useful to the end-user). I have to go through "Details >>" to notice that indeed the log file type may be incorrect. Please make sure that the error message is intended for the end-user, not the implementor.

2. Although there was an error in the import process and no record was imported, the log entry is created in the navigator view. I suggest that either a "red x" error icon be displayed as a decorator for that entry, or do not create the entry in the first place (since 0 record was imported). 

Reopening this bugzilla.
Comment 18 Dave Smith CLA 2007-05-23 03:51:05 EDT
Closing this because it is being used for the GLA changes which have been made.  The UI changes will be tracked with defect 177650
Comment 19 Hendra Suwanda CLA 2007-07-13 11:57:36 EDT
Closing