package com.xxl.job.executor.util;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 * 
 * Created by CXC on 2017/6/5.
 * 
 */

public class Log {
	public static void Logger(String dirNames, String content){
		File file = new File(dirNames);
		if(!file.exists())file.mkdirs();
		String path = dirNames;
		FileWriter fw = null;
		try {
			File F = new File(path);
			// 如果文件不存在,就动态创建文件
			if (!F.exists()) {
				F.createNewFile();
			}
			// 设置为:True,表示写入的时候追加数据
			fw = new FileWriter(F, false);
			// 回车并换行
			fw.write(content);
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (fw != null) {
				try {
					fw.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}

}
