Sunday, February 27, 2011

Mysql enable logging

mysql > tee output.log

Mysql has default built in function to logging transactions. In Mysql client, type above command. It will enabled logging in transaction. "output.log" file is created in Mysql bin directory.

Sunday, February 6, 2011

Find process id in linux

Use the below command to find the process id of your application. Here app name is "TestApp.jar".

ps -ef | grep TestApp

Run .jar file with log

Use the following command to run jar file for logging errors.

nohup java -jar -Xms1024m -Xmx2048m Test.jar &

Above command will run the "Test.jar" file in background and produce error file called "nohup" in same directory. ( All system out prints will be redirected into this file). So, developers can catch errors using the "nohup".

Wednesday, February 2, 2011

Mysql Current date & time

Use the Mysql server curdate() and curtime() functions to get current date & time values from the system.
Below SQL demos, the usage of the functions.

insert into test(cur_date,cur_time) values(curdate(),curtime());