{HowTo} WSO2 Carbon Server logs to be stored in a database

Thought of documenting this for my own reference, hope this will help. I am also planing to make a knowledge base article out of it to be posted in WSO2 Oxygen Tank.

As you may know, if your are familiar with Log4j, that the logs created with it, can be stored in a database instead of a file. In order to do that you need to add few configuration values to the log4j.properties file.

In-terms of a WSO2 Carbon based server this properties file resides in CARBON_HOME/lib directory. before adding these configurations there are few steps to visit.

[1] Create database {LOG_DB}
[2] Create the log table  {LOGGING} with the following fields

create table LOGGING (
             id decimal NOT NULL,
             prio varchar(15),
             cat varchar(255),
             thread varchar(30),
             msg varchar(255),
             layout_msg varchar(255),
             throwable varchar(2000),
             the_timestamp timestamp);

[3] Create a user and assign to the DB

           {user: logger / pwd: logger}

[4] Copy jdbcappender.jar to {CARBON_HOME}/lib and {CARBON_HOME}/repository/components/lib along with the database driver

           {jdbcappender.jar can be found at http://www.dankomannhaupt.de/projects/jdbcappender/lib/jdbcappender.jar}

Thats it. All preconditions are set, Now open up the log4j.properties file and add the following appender settings to the end.

#log to db appender
log4j.appender.DB_APPENDER=org.apache.log4j.jdbcplus.JDBCAppender
log4j.appender.DB_APPENDER.url=jdbc:mysql://localhost:3306/LOG_DB
log4j.appender.DB_APPENDER.dbclass=com.mysql.jdbc.Driver
log4j.appender.DB_APPENDER.username=logger
log4j.appender.DB_APPENDER.password=logger
log4j.appender.DB_APPENDER.sql=INSERT INTO LOGGING (id, prio, cat, thread, msg, layout_msg, throwable, 
the_timestamp) VALUES (@INC@, '@PRIO@', '@CAT@', '@THREAD@', '@MSG@', '@LAYOUT:1@', '@THROWABLE@', '@TIMESTAMP@')
log4j.appender.DB_APPENDER.layout=org.apache.log4j.PatternLayout

Scroll to log4j.rootLogger and add the appender to the list,

log4j.rootLogger=ERROR, CARBON_CONSOLE, CARBON_LOGFILE, CARBON_MEMORY, CARBON_SYS_LOG, DB_APPENDER

The Mozilla Seabird – “sadly it aint real”

“Sadly, Mozilla has no plans to develop this phone. The Mozilla Seabird is a “community-driven exploration” meant to “push the boundaries of the Web and the browser.” – ReadWriteWeb


Long distance traveling tips ;)

Recently I had to travel to US for work related matters, and found that traveling to the other side of the world is a “Pain in the ass”, On my 1st trip, I was quite excited, I haven’t been on a flight for more than 6 – 8 hours and by simply knowing that trip to US takes almost 30 hours made me pack more and more stuff for the journey itself (and seriously thats a bad idea).



So my second trip to US couple of day back, I knew whats coming and tried to make it far better than the previous. So here are the tips:

  1. Try to check-in early as possible (via on-line if possible) and catch an aisle seat in your flight.
  2. Don’t wear heavy uneasy cloths. (shorts, linen pants and t-shirts helps alot)
  3. Wear sandals if thats an option (Most security checkpoints in many airports ask you to remove your shoes and scan them 😛 so sandals do help)
  4. Carry only a backpack (check-in all your heavy bags as luggage)
  5. Take your laptop/ipad with you it helps to kill time in transit (or a book if thats your thing)

Five Powers that Get Ideas off the Ground via HBR

Came a across a short & sweet article on HBR blogs, thought of sharing; “Five Powers that Get Ideas off the Ground”,

[1] Showing up: the power of presence.
[2] Speaking up: the power of voice.
[3] Teaming up: the power of partnering.
[4] Looking up: the power of values.
[5] Not giving up: the power of persistence.