Hi Scott, I think I even mentioned this last time, but at any rate we are DEFINATELY going to provide a GUI and Programmatic way to set a Formatting delegate for that TextArea. I figure it's easier to encapsulate this as a delegate, Chainsaw will provide the Component that will render the message, plus the event and just let the delegate do what it does best.
The current code will be moved to the default delegate, and then you can just roll your own, or choose from a list of pre-packaged delegates. If you're interested in helping out with patches etc, I know I would any input, it could be a little while till I get around to this one. cheers, and many thanks for your discussion of how you're using Chainsaw (both versions). We always like hearing from people who use the products. cheers, Paul Smith On Thu, 2003-08-07 at 12:27, Scott Heaberlin wrote: > I know it's been well over a month since this was last discussed, but I > have had to revisit this issue at work this week and decided to share my > temporary solution - > > We have a third-party application which we use to screen-scrape > mainframe screen applications over a 3270 stream. In short, it's a > non-java application in which we use jscript to navigate command-line, > screen-based programs, retrieve and input data. We've managed to get > this application logging in-line with our java code using log4j, by > virtue of using activex (msxml) to send log statements to a servlet > which creates LoggingEvents. > > Anyways, whenever we encounter errors in the mainframe processes we > invoke, the easiest way to debug what was going on is to take a literal > screen-dump of the active mainframe screen at the time of the error. > Through scripting, we get an ascii "screenshot" complete with field > layout and messages that is the exact same character width and wrapping > as the screen itself on the virtual terminal. > > We loved using chainsaw v1 because it preserved formatting - imagine our > situation when we began receiving error LoggingEvents which merely > displayed in chainsaw v2 as an unformatted paragraph! It was impossible > to deduce the screen contents because the formatting was ignored. > > I looked into this and noted that the cause was the html formatting of > the message text area. > > My solution was to modify my local copy of > org.apache.log4j.chainsaw.ChainsawCyclicBufferTableModel::getDetailText( > ) to add the following: > > public String getDetailText(int row) { > boolean pastFirst = false; > StringBuffer detail = new StringBuffer(128); > detail.append("<html><body><table cellspacing=0 cellpadding=0>"); > > List columnNames = ChainsawColumns.getColumnsNames(); > > Vector v; > > synchronized (syncLock) { > v = (Vector) filteredList.get(row); > } > > if (v == null) { > return ""; > } > > ListIterator iter = displayFilter.getDetailColumns().listIterator(); > String column = null; > int index = -1; > //BEGIN PATCH > String pre, post = ""; > //END PATCH > while (iter.hasNext()) { > column = (String) iter.next(); > index = columnNames.indexOf(column); > //BEGIN PATCH > if (column.equals(ChainsawContsants.MESSAGE_COL_NAME)){ > pre = "<pre>"; > post = "</pre>"; > } else { > pre = ""; > post = pre; > } > //END PATCH > if (index > -1) { > if (pastFirst) { > detail.append("</td></tr>"); > } > > detail.append("<tr><td valign=\"top\"><b>"); > detail.append(column); > detail.append(": </b></td><td>"); > //BEGIN PATCH > detail.append(pre); > //END PATCH > detail.append(escape(v.get(index).toString())); > //BEGIN PATCH > detail.append(post); > //END PATCH > pastFirst = true; > } > } > > detail.append("</table></body></html>"); > > return detail.toString(); > } > > > I just figured I'd send this and at least get it archived on the mailing > list. It's been a great help to us java webapp developers working in a > predominately mainframe shop. > > Regards, > > > -Scott Heaberlin > [EMAIL PROTECTED] > > > > > > -----Original Message----- > > From: Paul Smith [mailto:[EMAIL PROTECTED] > > Sent: Monday, June 23, 2003 6:12 PM > > To: 'Log4J Developers List' > > Subject: RE: Chainsaw V2 Message details > > > > > > Nope, you've done nothing wrong, this is just how we felt > > worked best for us. We currently have in plan a Dynamic > > formatting component that will render the details of the > > event using XSLT (or equivalent), and you'll be able to pick > > your own formatter (or even create your own) using the GUI. > > > > Many thanks for letting us know your preference. If there is > > anyone else out there that thinks the old format is better, > > we can go with the flow and enable that original format by > > default when we release. If anyone wants to help out with > > the development, even better! > > > > cheers, > > > > Paul > > > > > -----Original Message----- > > > From: Joerg Eggink [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, 24 June 2003 12:51 AM > > > To: [EMAIL PROTECTED] > > > Subject: Chainsaw V2 Message details > > > > > > > > > Dear all > > > > > > I just download and build chainsaw V2 and it started > > > successful without > > > any problems. > > > But I saw one different to previous version of chainsaw > > which was much > > > better. > > > In previous chainsaw version I had a message details output > > like this. > > > > > > -----------chainsaw old------------------------------------ > > > Time: xxx Priority: DEBUG Thread: thread10 NDC: User:123 > > > Category: a.b.c > > > Location: 123 > > > Message: > > > > > > This is > > > Some example > > > text with > > > Line feed. > > > It should not > > > be in one line. > > > > > > Throwable: > > > null > > > ------------------------------------------------------------ > > > > > > In chainsaw V2 the output is like this > > > > > > -----------Chainsaw V2-------------------------------------- > > > Time: xxx Priority: DEBUG Thread: thread10 NDC: User:123 > > > Category: a.b.c > > > Location: 123 > > > Message: > > > > > > This is some example text with Line feed. It should not be in > > > one line. > > > > > > Throwable: > > > null > > > ------------------------------------------------------------ > > > > > > > > > Do I make something wrong or is the output of chainsaw different ? > > > Personaly I prefer the previous output much more. > > > > > > > > > Regards > > > > > > Joerg > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]