log4j monitor tool Log4j Web Tracker

It is good tool , git is HERE.

Steps are

    1. add dependency in Maven or build yourself and add to library.
    2. add servlet mapping in web.xml
    3. In the example the tool was mapped as /tracker/*, so if the application is accessible in http://localhost:8080/myapp, the correct URL to access to the tracker is:



Just remember to add the appender you need to display in the web UI under the root element in the log4j xml config file.

Root is a special logger.

By specifying a log level in root element, it will contain all the log info in the current app.


Nexus 4 battery life drainage issue

My Nexus 4’s battery life just sucks when I got it. It is like dropping every time I look at the battery percentage.

My Solution

flash Matr1x kernel

In my another post, I found some very important settings for battery saving, especially if you have “Android OS” drainage problem. 

The steps comes from this POST. I made some changes to it so that it would not be that complicated as described there.

Matr1x is a custom kernel developed by XDA recognized developer mathkid95 who is also the dev behind the Matr1x custom kernel for the Google Nexus S. This time, the said dev is ready to mod another Nexus device with this new custom kernel.

The recent build is still being updated by the developer and many have commented on the amazing battery optimization that comes with the package. Its recent version comes with ARM CPU Topology which makes your device more efficient.  The GPU has also been overclocked to 450 MHz and all cores have been undervolted to 100 mV.

This guide shows you how to flash Matr1x kernel for the Nexus 4.



  1. Copy the Matr1x kernel package into your phone’s internal SD card.
  2. Turn your phone off.
  3. Reboot into ClockworkMod Recovery. To do this, boot into Fastboot Mode by holding down the Volume Down and Power buttons at the same time until you see the word “Start” on your phone’s screen. Scroll down using the volume buttons and select “Recovery Option” to finally boot into ClockworkMod Recovery.
    • Note: Use the Volume buttons to scroll up and down and the Home/Power button to select an option if you are not using the touch version of ClockworkMod Recovery.
  4. Create a NANDroid Backup of your existing ROM. Go to Backup and Restore > Backup.
  5. Wipe your phone’s data. Do the following:
    • Select Wipe Data/Factory Reset > Yes.
    • Select Wipe Cache Partition > Yes.
    • Select Advanced > Wipe Dalvik Cache > Yes.
  6. Install the Matr1x ROM. Select Install ZIP from SD Card > Choose ZIP From SD Card.
  7. Locate and select the Matr1x-cfs_v1.5.zip file and confirm that you want to install it.
  8. Once installed, select Go Back > Reboot System Now.

Congratulations! You have installed the Matr1x kernel on your Google Nexus 4. Don’t forget to share your thoughts to us about this kernel’s performance.

Deploy war application in Tomcat as ROOT

After deploying the war file in webapps,

I need something like this:
NOT this:


There should be 3 ways to do it:


rename the war to ROOT. war




create a new HOST entry in TOMCAT_HOME/conf/server.xml

  1. <Host name=”www.mysite.com” appBase=”www”
  2.       unpackWARs=”true” autoDeploy=”true”
  3.       xmlValidation=”false” xmlNamespaceAware=”false”>
  4. </Host>

with this sample setup, you will have a folder in the root of TOMCAT_HOME called ‘www’, and it will only work with the host name www.mysite.com – all other requests (localhost,, etc) will hit the localhost host configuration.

In the ‘www’ folder you need to have a ‘ROOT’ folder, which again contains the contents of your ‘myapp’.




Deploy war as (for example) war_name.war and configure the context root inside the < Host > element of conf/server.xml to use your war file :

<Context path="" docBase="war_name" debug="0" reloadable="true"></Context>

The first one is easier, but a little more kludgy. 
The second one works for specific domain.
The third one is probably the more elegant way to do it.

Add User to root Group on CentOS VPS

1. Add a new user. In this example, I used ‘myroot’ and then set the password.

[root@CentOS57 ~]# useradd myroot
[root@CentOS57 ~]# passwd myroot
Changing password for user myroot.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

2. Check current groups for ‘root’ user.

[root@CentOS57 ~]# groups
root bin daemon sys adm disk wheel

3. Add ‘myroot’ into root group as below:
useradd -G {group-name} username

[root@CentOS57 ~]# usermod -G root myroot

4. Switch to ‘myroot’ user. Then Check current group for ‘myroot’. root group will be the second group for ‘myroot’.

[root@CentOS57 ~]# su - myroot
[myroot@CentOS57 ~]$ groups
myroot root

5. Grep the ‘myroot’ user’s group.

[root@CentOS57 ~]# grep myroot /etc/group

6. Edit /etc/passwd file,find the following line,change the user ID to 0 :


After modification:


save,get root privilege after login as myroot。

Explanation : Only the owner which is ‘root’ user can edit the /etc/passwd file, not in the root’s group.