import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.Reader; import java.util.Properties; import org.apache.log4j.PropertyConfigurator; public class LogConfigruration { public static void initLog(){ String logProper = System.getProperty("user.dir")+"\res\log4j.properties"; Properties prop = new Properties(); Reader reader = null; try { String log_dir = System.getProperty("user.dir")+"\test-output"; System.setProperty("LOG_DIR", log_dir); reader = new FileReader(logProper); prop.load(reader); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } PropertyConfigurator.configure(prop); } }