Category Archives: Soft Where It Hurts

[BlogEntry] Display source line numbers in Chainsaw with Log4j

This is the single most difficult piece of information to find on all the web.

Lemme see, what did I Google for?

  • SocketAppender layout
  • chainsaw ConversionPattern
  • source line number log4j
  • chainsaw location line number
  • jakarta apache commons-logging log4j chainsaw layout please oh please show me my freaking line numbers

I'm not sure why this is the most elusive tidbit of information on the face of the earth, but I'm going to open the kimono and let you in on the secret…

Can I tell you how many variations on the ConversionPattern I tried? It's in the dozens. None of them worked.

log4j.appender.chainsaw.layout.ConversionPattern=%d{DATE} [%-5p] %c {%F:%L} - %m%n
log4j.appender.chainsaw.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.appender.chainsaw.layout.ConversionPattern=%d [%t] %-5p %c {%F:%L} - %m%n
log4j.appender.chainsaw.layout.ConversionPattern=%d [%t] (%F:%L) %-5p %c - %m%n

Pretty sick when you find out all you need is locationInfo=true.

This is why I'm JCranky.

[BlogEntry] Are you stingy with your clicks?

The Internet has become such a gift to humanity, but I wonder how aware of this we actually are.

  • My wife got the oil changed in her car, but they put in 10W30 instead of the recommended 5W30. She wanted to know the difference, so she went to Google. How would she have researched this before the web? Go to the library. Try to find a mechanic willing to answer her question.
  • As a developer, I am blown away by the quantity and quality of all the free software out there for the taking. From bottom to top, there is just so much it boggles the mind. Linux, Java, Apache, Tomcat, Eclipse, Spring, Struts, Hibernate, Log4j, JUnit, etc. Look at all the free blogging software! (Thanks, Simon!) As a friend of mine says, we are living in the Golden Age of Software. (It's a GAS, GAS, GAS! <-- That corny part is mine, not his. 🙂
  • Virtually any question that comes up nowadays, I immediately turn to the web, and primarily to Google.

However, I've become aware of the fact that I have been stingy about clicking on links that would benefit the people and sites that make this treasure trove available.

Have you ever avoided buying something on someone's site, because it was through their affiliate link? I have noticed I have a resistance to that.

Do you ignore or avoid Google Ads on peoples' sites? I have.

Now, admittedly, we're all as busy as we can be, writing our own free software or putting our own free information on the web. But it makes sense for us to support all that we benefit from by taking a moment to encourage and reward the effort.

Where would we all be without Google? I rely on Google hundreds of times a week, if not a day. I make use of tutorials and software I find through Google every day of my working life. And while Google is doing quite well in the process, they offer their service to me for free any time I want, as much as I want. When you think about it, that's an unbelievable gift! Sure, they're in it for themselves, but they genuinely enrich my life. (I could go off on a tangent here, singing the praises of capitalism, but I will restrain myself. You're welcome. 🙂

I just went to to download Groovy when I noticed that they have Google Ads on their site. I immediately looked away, as if it has become a reflex to block out all rectangular, revenue-generating portions of a web site — a web site that it giving away a powerful development tool and even the source code for me to use in any way that I please!

This just doesn't make any sense. It costs me virtually nothing to click on a link intended to be relevant to the page I'm on. That click also benefits the owner of the site making something valuable available to me for free. It also benefits Google, and it potentially benefits the advertiser, if I buy what they are selling. And what they are selling may benefit me! Why would it be so automatic for me to ignore or avoid it?

I'm turning over a new leaf. I'm going to start giving back to the sites that give so much to me. I'm going to be more generous with my clicks, in an effort to say thank you for open-sourcing your hard work, thank you for enriching the world wide web, thank you for your generosity.

The more we reward people and companies for providing what we want, the more they'll offer us. (Another nod to capitalism.) I intend to say thank you with my clicks, in order to enrich my own online world. Care to add your clicks to mine?

If you would like to join me in this resolution, please just remember that it is unfair to overdo it. If people start heedlessly clicking on Google Ads or banner ads, it could hurt the advertisers, which would ultimately hurt the providers such as Google. So please be supportive, not abusive.

Here are some of the many sites or products I benefit from daily that ask nothing of me in return for their service:

At the time of this writing, I have no Google Ads or any other revenue-producing banners on this blog. But I reserve the right to add them. 🙂

[BlogEntry] I've been waiting about seven years for this simple yet crucial feature…

I can't believe how long we browser users have tolerated this fundamental flaw. Ever since the target="_blank" attribute was added to the HTML anchor tag, we have lived with the uncertainty of whether a link would replace the current page or open a new page. I don't know if Jakob Nielsen ever screamed about this issue, but I found it to be a really annoying, fundamental oversight that I bumped into almost every time I clicked a link. (My penchant for opening lots and lots of browser windows is legendary, which led to

Once again, I'm feeling a little less cranky than I used to. (If I get too damned cheerful, I may have to rebrand my blog! There, I'm cranky again.) Thanks to TargetAlert, I can finally, after the better part of a decade, see a visual indication of whether a link opens in a new window or not. Kudos, Michael Bolin, kudos! And thank you to the Mozilla Firefox team for creating a platform that allows such extensibility!

Too bad URLinOne doesn't currently work with Firefox. D'oh!

[BlogEntry] Tapestry is a quantum leap, a paradigm shift, a mazing [sic]

I have been looking for something for the past four or so years, and it turns out it was Tapestry! What's odd is that I first looked at Tapestry about sixteen months ago, but I had apparently not suffered enough at the time to recognize the relief that it offered.

Interestingly, Tapestry smells a lot like Spring (without the allergies). It's a dependency-injecting, aspect-oriented, proxy-building, clean and intuitive way to approach the web layer. It's the first web technology that has really felt right.

I'm feeling less JCranky! I think I might even be having fun again, although I can't really remember what that feels like.

[BlogEntry] Locating within Eclipse

When you try to run a program that does logging from within Eclipse, have you ever seen this:

log4j:WARN No appenders could be found for logger (com.greymatter.MyClass).
log4j:WARN Please initialize the log4j system properly.

This happens because Log4j can't find its .properties file, so it can't configure its appenders, so you don't get any logging information. Here's how to fix this…

  1. In Eclipse, in one of the several places where you can find this, select either Run… or Debug… (Your change will apply to both types of program execution.)
  2. In the tree view on the left, select the Configuration you'd like to run with logging enabled.
  3. Click on the Classpath tab along the top.
  4. Click on the User Entries item in the tree view to select it.
  5. Click the Advanced… button.
  6. Select the Add Classpath Variables radio button, and click OK.
  7. If you see LOG4J_PROPS in the list of variables, select it and click OK. If it is not in the list, click the Configure Variables button. Add a Classpath Variable named LOG4J_PROPS with a value of the absolute path to the folder that contains the file. Once you've completed this process of adding the new variable, you will of course need to select it as you would have done if it had already existed.
  8. Click Apply to save your changes.

That's it! You should now be able to run or debug your app in Eclipse and have log4j configure properly. Ain't life grand?!

Revised January 17, 2005

[BlogEntry] Mozilla Firefox Extensions

A couple of weeks ago, I installed
Mozilla Firefox, and I've got to say it's an environment in which I became very comfortable very quickly. I've had a few problems with printing, and there are still some kinks to be worked out, but it is overall a very usable browser.

One of the really nice features is the inherent extensibility of the platform. I've installed a couple of very powerful Extensions that make life so much easier. My favorite is
Mouse Gestures by Optimoz. If you've ever used a Palm to write in Graffiti, mouse gestures are a very natural way to interface with a computer. Even if you've never used Graffiti, this is not a hard thing to pick up. It's so cool to be able to open links, move from tab to tab, close tabs and windows, and do pretty much everything I want to do with simple mouse movements anywhere in the browser window. It sure beats having to travel across the screen and aim and click on a small area to execute a command. Considering that I probably execute <swag>10,000</swag> little commands a day, reducing the effort in each one adds up to a lot of savings.

Incidentally, if you've been through the extensive search I have to learn how to create Mozilla Extensions, it's almost spooky how hard it is to find the information. I think it's a better kept secret than Area 51. Here is the one and only tutorial I found on all the web! Thanks, RoachFiend! (With a handle like that, you'd better be careful about exposing such carefully guarded government secrets. 🙂

The interesting thing about Extensions, from what I read in Eric's excellent tutorial, is how simple they are to write. Admittedly, I'm brand new to the whole process, but it looks like the folks at Mozilla really did a nice job of making an already powerful platform easily extensible.