Added log code and test program