Using Java Logging Framework. Compacting the code