-
Notifications
You must be signed in to change notification settings - Fork 182
Description
LogExpert version 1.6.13 on Windows 7
I am currently trying to write a custom columnizer. While it is basically working I do have one issue and I do not know if I'm misunderstanding the LogExpert functionality, or I have made a mistake in the code.
I have a log file that contains multi-line entries (e.g. stack traces associated with a single log file entry), but the entries do have start and end tags so I can reliably identify a single entry, even when it spans multiple lines. Using the bundled Glassfish columnizer as an example, I used the ILogLineXmlColumnizer interface with a class implementing the IXmlLogConfiguration interface setting the XmlStartTag & XmlEndTag appropriately and the Stylesheet to null (As an aside this was quite confusing that you can use ILogLineXmlColumnizer with non-XML data), thus I thought that the ILogLine line parameter passed to the SplitLine method which represents a single log file entry would contain new line characters, I would then process as normal.
I appears I was wrong or I have made a mistake in my code, as each of the ILogLine lines passed to the SplitLine method seems to be a single text file line, still split by each and every new line character. Thus each line of the stack trace (all associated with a single log file entry) is treated as a separate log file entry by LogExpert.
While I can identify these lines and locate them into the correct column so the data displayed in LogExpert initially appears correct, functionality like the highlighting and filtering is severely limited, for example if I highlight or filter based on say a log level keyword I would expect the entire multi line log entry to be highlighted or displayed in the filter window (not just the first line which has the log level on it).
Hopefully this makes sense? So my question is, is LogExpert working as expected or is the a bug somewhere, quite possibly in my custom columnizer code?
In an attempt to try to answer my own question I did go digging in the LogExpert source code and did spot some things which may be relevant, though please be aware it was a VERY brief look and I might not understand things correctly or how the code fits into the big picture. In the class "XmlBlockSplitter" there is a method "ParseXmlBlock" and this is where it appears to decide if your data is XML or generic multi line text:
private void ParseXmlBlock(string block)
{
if (this.stylesheet != null)
{
XmlReader xmlReader = XmlReader.Create(new StringReader(block), settings, context);
xmlReader.Read();
xmlReader.MoveToContent();
//xmlReader.MoveToContent();
StringWriter textWriter = new StringWriter();
this.xslt.Transform(xmlReader, null, textWriter);
string message = textWriter.ToString();
SplitToLinesList(message);
}
else
{
SplitToLinesList(block);
//this.lineList.Add(block); // TODO: make configurable, if block has to be splitted
}
}
Note the TODO comment. At the moment the text block is always passed to SplitToLinesList where it is split by the new line strings "\r\n", "\n", or "\r".
I would welcome any comments on my analysis.
Kind Regards,
Rowton