Update BadApp.java

Refactored writeErrorLog() to use overloaded method and tidied up code.