Code in chapter (3)
Fw.write (Enter_code);
for (Logconfigbean lc:list) {
Writelogwithmodule (FW, LC);
Fw.write (Enter_code);
}
} catch (FileNotFoundException e) {
Log.error ("File" + backfile.getabsolutepath () + "not found \ n"
+ e.getmessage ());
} catch (IOException e) {
Log.error ("File" + backfile.getabsolutepath () + "IOException \ n"
+ e.getmessage ());
} finally {
Close the stream
if (null! = FW) {
try {
Fw.close ();
} catch (IOException e) {
Log.error ("Close file" + Backfile.getabsolutepath ()
+ "IO error\n" + e.getmessage ());
}
}
}
String log4j = Web_inf_path + log4j_properties_name;
Backfile.renameto (New File (log4j));
}
private void InitData (FileWriter fw, String key, String value)
Throws IOException {
Fw.write (key + "=" + value + enter_code);
}
private string Initpropsdata (Properties props, string key,
String DefaultValue) {
String value = Props.getproperty (key);
Value = (value = = NULL | | ". Equals (Value.trim ()))? DefaultValue
: value;
Return key + "=" + value + enter_code;
}
Log framework for real-time modification, real-time effective, concrete framework ideas (4)