BlogicBlog: View from the trenches

The blog about Java and XML with focus on troubleshooting issues and tools.

Wednesday, March 22, 2006

Why I prefer Andrew C. Oliver to write 'drab' articles

Permanent article link

Andrew is confused why his 'drab' article on speeding up JBoss is much more popular than his repost of a deep voodoo article asking other people to implement someting that he finds interesting. I wonder!

I have linked to the speeding up article when I saw it, because it was something useful either immediately or later if I do have strange slow-downs/memory issues to troubleshoot. It (as I mentioned originally) was also useful beyond JBoss and I knew that because I had to explain the same issues to the customers using Weblogic.

His other article seems to requite much more thought and a deeper involvement. Maybe one day I will have free time and skills to understand that article as I am sure it deserves to be. But probably not soon.

P.s. I am not vain enough to think that my opinion really deserves a full blog entry (and I saw the article from JavaBlogs' pupular list anyway); it is just that he doesn't have the comments enabled.....

BlogicBlogger Over and Out

Oh Tomcat of the multiple conflicting ports!

Permanent article link

Ever tried running multiple Tomcat on the same machine and have that fail because of the port conflict. And not because of the HTTP listen port conflict - because you did know about that one and changed it. But, rather, because of the other ports that are open out of the box as well that even Tomcat's documentation does not mention.

So, turns out that Tomcat 5, has 3 ports open and what interesting ports they are:
  1. 8080 - that's the one they tell you about and it is where all the normal HTTP traffic goes to
  2. 8009 - that's an AJP connector that you need if you are behind a webserver like apache that will pass the requests to you. Why is it on by default, I don't know. You have to configure the webserver side anyway, how difficult would it be to uncomment it at the same time. And if - for whatever reason - you are running Tomcat on its own, you now have another obscure port to worry about as a management hassle or even a possible attack vector.
  3. 8005 - This one is interesting. It is binded to the localhost only and it is how you shutdown the tomcat when you run the shutdown script. And to shut it down, all you need to do is telnet to the port and say the magic word, which for tomcat 5.0 is hardcoded at SHUTDOWN and for 5.5 is helpfully kept in the open in the server.xml . You don't even need to be the same account to do this, just a user on the same system. This small issue has been acknowledged by the Tomcat's team.
So, to make this also a fishing lesson rather than a handout of seafood, here is a generic way to check those ports without having to page down the 19K of semi-commented-out XML.

The command should be all in one line:

...\xmlstarlet-1.0.1\xml sel -T -t
-m //*[.//@port]
-m ancestor::* -o -+ -b
-v local-name()
-i @port -o : -v @port -b
-n
server.xml


The command line above means: for each element that has an attribute port or a child with such an attribute, print the element with offset based on it nesting depth; if this particular element does have the port attribute, print the port value as well.

The result for the default Tomcat's setup is:

Server:8005
-+Service
-+-+Connector:8080
-+-+Connector:8009


BlogicBlogger Over and Out

Monday, March 20, 2006

Review: Log4j Chainsaw v2

Permanent article link

Recently, I had been contacted by one of the Chainsaw's developers - Scott Deboy (no blog yet). He asked if I had any feedback on the tool's new iteration as it would seem to be a good match to my interests and blog's goal.

I had looked at the Chainsaw a while ago, but it was not quite up to scratch then. Looking at it again, the tool feels much better and if you have to look at the log files, I strongly recommend to check it out (and/or Splunk).

Initially, Chainsaw may feel a little forbidding due to a large feature set. But as with other strong tools, such as Ethereal and XMLStarlet, if you have to deal with the problem space repeatedly, these tools make it worth your while. And all of those features are actually useful and come from attacking real problems. This is quite a different feel to some of the vendors' tools which look shiny, but fail in real use.

I do however have some gripes that I feel would make troubleshooting much faster if resolved. Most of them are around (otherwise great) highlighting and expression facilities.
  1. For the fields that take an expression, it would be good to see whether the expression typed in so far is correct. Ethereal does this quite nicely. Expression builder is good for beginners, but immediate correctness feedback would be useful for those that are more advanced.
  2. It would be good to have the highlight rules available as a view/pane. In Vim (with OTF script installed) - I can highlight with as little as :1OTF XYZ (1-9 is a color index). So, the price of verifying an idea is very quick. I feel both Ethereal and Chainsaw are slightly behind in that respect. In addition, I can highlight multiple elements in a line with different colours. That really helps sometimes. Again, nothing else I have seen allows me to do that.
  3. The expression window for Next/Previous navigation does not seem to have keyboard shortcuts equivalent to the buttons and requires switching hands from the keyboard to the mouse. Having keyboard mapping would be faster. Some other window also did not seem to respond to Enter key and required switching to the mouse, but I did not note which one.
  4. Bookmarking a particular line and ability to come back to it quickly would be great. This feature however is more nice than important.
So in summary, Chainsaw is very nice, but still with some room to grow.

BlogicBlogger Over and Out