Tuesday, December 29, 2015

Get you current class name in logger log4j using Java

Log4j is very important utility for debugging error in Java code. This low level utility will give the exact class, method and line where error is occurred.

Just declare the below line in Base class which is extended by child class

public final Logger logger = Logger.getLogger(this.getClass().getSimpleName());

Eg:
In my com.aut.AppTest.java
logger.info("this line is to debug java code");

OUTPUT
2015-12-29 16:45:32 INFO  AppTest     - this line is to debug java code

Now if getSimpleName() is replace by getName() the logger will log details of package as well.

Monday, November 23, 2015

Ubuntu Install guest addition via Terminal

I faced issue with installation of Virtual box guest addition for making my Ubuntu Virutal OS full screen.

I tried after starting ubuntu virtual machine.
Devices > Install Guest addition.
Got error message and unable to install even after force mount.

Solution:
I install virtual box guest addition via terminal with below command
sudo apt-get install virtualbox-guest-utils

Monday, October 12, 2015

Hidden Google chrome Browser game

Hidden Google chrome Browser game when internet is disconnected. Press UP arrow key to start

Thanks Sankalp

Read CSV from S3

 import csv def count_records(csv_file):     record_count = 0     first_line = None     last_line = None     # Open the CSV file and read it...