Bootstrap

java 后台实现记录日志的功能

1.编写实现记录日志的静态方法


To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
*/
package util;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
*记录日志

@author muicc
*/
public class TaskListUtil {
public static void wirteFile(String filePath,String conent){
BufferedWriter out = null;
try {
File file = new File(filePath);
if (!file.exists()) {
try {
File fileParent = file.getParentFile();
if (fileParent != null) {
if (!fileParent.exists()) {
fileParent.mkdirs();
}
}
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filePath, true), "UTF-8"));
Date date =
;