Saturday, September 15, 2012

Quick ways of doing code reviews and sanity checks in OSB

I have been asked to check that all log statements are done with "debug" level, as someone does it with "error" and then you end up with a lot of garbage in Production.

The stupid way is to click around.

The smart way is:

- export a sbconfig.jar with all the projects
- unzip the sbconfig.jar in a directory. You will notice that each Proxy is a XML file with .ProxyService extension
- open XMLSpy and open one of those .ProxyService xml file
- menu XML, Evaluate XPath
- enter //*:log[*:logLevel != 'debug' and *:expr/*:xqueryText != '$faultVar']
(normally we log with "error" level only the faultVar
- if you find NOTHING, then cool
- you can run the XPath on ALL files in a given folder (see "where" button in XMLSpy)

for more info: http://www.altova.com/xmlspy/xpath-analyzer.html


The way I ahve done it, use Everything Search to identify all .ProxyService files, copy them into a folder, drag and drop them in XmlSpy so that they are all open.

Select "Open Files" in the XPath Evaluation tab, and run the little "evaluate XPath" button.




No comments: