/** * Writes information to the log * @param content * @return * @throws IOException/public static Boolean Writelog (String classn
Ame,string errorinfo,string errorcontent) {String content=info (className, ErrorInfo, errorcontent);
File FileName = new file (System.getproperty ("User.dir") + "/config/log.log");
Randomaccessfile mm = null;
Boolean flag = false;
FileOutputStream o = null;
try {o = new FileOutputStream (filename,true);
O.write (Content.getbytes ("Utf-8"));
O.close ();
Flag = true;
catch (IOException e) {e.printstacktrace ();
finally {if (mm!= null) {try {mm.close ();
catch (IOException e) {e.printstacktrace ();
}} return flag; /** * * @param className class name * @param errorinfo error message * @param errorcontent Error content * @return/Public St
Atic string Info (string classname,string errorinfo,string errorcontent) {stringbuffer buffer=new stringbuffer ();
Date date = new Date (); SimpledateFormat sd = new SimpleDateFormat ("Yyyy-mm-dd HH:mm:ss");
String d = Sd.format (date) + "\ r \ n";
Buffer.append (d);
Buffer.append ("Error class Name:"). Append (ClassName). Append ("\ r \ n");
Buffer.append ("error message is:"). Append (ErrorInfo). Append ("\ r \ n");
Buffer.append ("Error content:"). Append (Errorcontent). Append ("\ r \ n");
Buffer.append ("\ r \ n");
return buffer.tostring (); }