Tuesday, August 17, 2010

Hotdeployment of properties file

Hi,
     In last month we faced another Internationalization problem with properties file hot deployment. Hot deployment is commonly used to deploy updates for live web-application.
    The problem was when we hot deployed web-app the messages of  new screen are not pulled from corresponding properties file. ResourceBundle unable to find new keys ,leading to all labels are showing keys. But when we restarted server the messages are shown perfectly.
     After analyzing we realized that the properties file are not reloaded after hot deployment while all other classes are reloaded properly.This is because of ResourceBundle class, it caches properties file on read and returns retrieve strings from cache. When the class redeployed this cache remain untouched.
     The solution to this to clear this cache. we added static block in our class to clear ResourceBundle cache.
following is the code we currently using :

Monday, May 31, 2010

Remove lines from log not matching search criteria

Hi folks,

    In last week I am walking through our application log file for performance enhancement. Where I was continuously needed to find some method logs (like time consumed etc ). The log file i retrieved from test server is almost 80 MB . As I was only interested in to the retrieval of particular method logs ,to analyse the trend. So what I needed was to remove all other lines from log file which don't contain my method. I have done this using my favorite editor VIM . For that i Just needed  to fire 2 commands. I found this is very easy and useful.let's see,

Suppose I have to find all logs for method getUiControls the commands will be
  • Search The string 'getUiControls' in vim
        /\c^.*getUiControls

          here you can confirm whether the highlighted lines shows your selection criteria (For Advanced VI          users : you can build any search queries to get intended selection)

  • Delete all lines not selected in previous search ,This command must follow 1st .
            :v//d



Thanks