It's probably difficult to handle all cases but I'll be happy with a solution that handles 75% of the cases. I'm definitely not the perfect programmer to have a single exit point for all my methods but really there are only a handfull of ways to exit out of a method that I can think of: 1. Reach the end } of a method 2. Forced "return" statement 3. Forced "throw" statement 4. uncaught RuntimeExceptions (we probably can't handle this case)
It seems the first three conditions we should be able to parse somehow and insert a trace statement before it is called. I think it can be done but I'm not sure how yet. -Benson Paul Glezen wrote: > Hi Benson, > > It's not as easy as it looks to do "intelligently". While it is often > taught that methods should have a single entry point and exit point, not > many programmers adhear to this. It is not at all uncommon to find return > statements in if-blocks and try-catch blocks. Sometimes the exit logic can > get very convoluted. > > I've always been partial to single exit logic. I didn't become a fan until > trying to insert trace statements, just as you describe, in other people's > code. It can be a nightmare. > > - Paul > > Paul Glezen > Consulting IT Specialist > IBM Software Services for WebSphere > 818 539 3321 > > Benson Chen <[EMAIL PROTECTED]>@porivo.com on 12/17/2001 01:57:15 PM > > Please respond to "Log4J Developers List" <[EMAIL PROTECTED]> > > Sent by: [EMAIL PROTECTED] > > To: [EMAIL PROTECTED] > cc: > Subject: automatic trace insertion > > Hi all, > > I'm interested in automatically inserting log4j trace statements at the > beginning of all methods and right before the end of a method (return > statement or thrown exception). I'm presuming most people have worked > on projects with extensive class libraries and it would be great if > there was a class parser that could intelligently insert log4j > statements automatically. If there isn't anything out there like that, > does anyone know of a java class parser that can be used to do this sort > of thing? Thoughts or ideas? Thanks! > > -- > Benson Chen > Director of Software Engineering > Porivo Technologies, Inc. > Phone: (919)806-0566x12 > E-Mail: [EMAIL PROTECTED] > "Measuring end-to-end Web performance" > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- Benson Chen Director of Software Engineering Porivo Technologies, Inc. Phone: (919)806-0566x12 E-Mail: [EMAIL PROTECTED] "Measuring end-to-end Web performance" -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>