Monday, December 19, 2011

Valhalla Koan: Logging Without Logging

OK, this isn't really a koan, because there is an answer.  The more mundane version of the question is, how do you make log statements to diagnose why your favorite logging framework isn't working.

Just as parents can learn from their children, those close to mastery can learn from the neophytes, System.out.println is usually acceptable (you're web-container may vary).

If you're using WebLogic 11g, their logging documentation can be just as confusing as a koan.  Fortunately, as a part-time hipster I'm really into their earlier work (i.e. their prior documentation actually makes sense).

So, to get to the point, if you want to use the WebLogic logging before you initialize your favorite like (like Log4j) you can:

  1. Use the simpler WebLogic APIs for logging until your main logger is working.
  2. You may have to have your WebLogic server use more logging statements (mine was set to only WARNs and above but all of my logging statements were INFO until I changed it).  You can do that by:
    1. Logging into the WebLogic Console.
    2. Going to Environment -> Servers.
    3. Select the server you want.
    4. Click on the Logging tab.
    5. Expand the Advanced section.
    6. Turning everything to DEBUG or TRACE. 
    7. Save your changes.
    8. Restart the server.
    9. Finally, redeploy your application.
  3. Then you can trigger the early logging statements and view them in the WebLogic Server Administration Console.
If you're familiar with Oracle and WebLogic products, you appreciate how this is as simple and straightforward as it gets.

Wednesday, December 14, 2011

My Technology Fail: Using JMeter for Integration Testing

Engineering Fail from MemeHumor.com
Please don't do what I did: I made my Maven build run JMeter, record all data retrieved (JMeter option) and then verified the data after as my integration test.

Please, just use HtmlUnit since it's designed for this to begin with.

Note that JMeter is great to use what it's made for: load testing.  Thanks to Manfred Reim for writing his blog post about HtmlUnit, it's what made me realize my mistake.

Friday, December 9, 2011

SpEL in JSF

I've been having an awful time getting SpEL to register in my JSF .xhtml pages.  I just want to do a simple

...

However, my project would give me an error saying that '(' was unexpected. This was despite the Spring Documentation saying that SpEL is the default expression language.

I made some head way when I put the following into my spring configuration xml:






This should work with JSF 2.0, but my project uses JSF 1.2 so I got a cast exception since JSF 1.2 uses the org.springframework.binding package instead.
The following should work with JSF 1.2 (I'll test this soon).




  
    
    
  
  
  

If you're using Spring Web Flow (SWF) then you'll need a different expression parser; use org.springframework.faces.webflow.FacesSpringELExpressionParser with the same constructor-args.
Note how it wraps the new SpelExpressionParser.

I've done thorough Google searches on this topic and found nothing, so as far as I can tell this is unique information!

Thursday, December 8, 2011

Old Dogs Must Learn New Tricks

An article at TheServerSide grabbed my attention violently: it was claiming that your professional "half-life" as a programmer is at 35.  This was immediately disturbing since it took me until 28 to really land my first professional programming job.

From reading the comments it seems that the consensus is that the person was basing his experience solely off of Google, who has a notorious youth-culture, and that if you keep your skills current you should be just fine.

Or, to put it another way, old dogs must learn new tricks to survive.