Sers Leute habe ein Prob mit schreiben in eine txt datei ...
ich weis nicht was es ist, sonst würde ich ja nicht fragen 🙂
also hab einies schon ausprobiert aber nix hilft ... evtl sieht ja wer das prob
ich will das die logs in die txt geschrieben werden ...
mfg[/code]
ich weis nicht was es ist, sonst würde ich ja nicht fragen 🙂
also hab einies schon ausprobiert aber nix hilft ... evtl sieht ja wer das prob
Code:
public class Main
{
private static Writer fw;
public static void main(String[] args) throws Exception
{
try {
File file = new File("ServerLog.txt");
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy kk:mm",
Locale.GERMAN);
if (file.canRead() && file.canWrite() && file.exists()) {
fw = new FileWriter(file);
GateWayImpl stub = GateWayImpl.getInstance();
// log auf StdOut
RemoteServer.setLog(System.out);
// NameServer - rmiregistry starten
try {
Registry registry = LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
// ServerProxy bei Namensdienst bekannt machen
registry.rebind("rmi://localhost:1099/VidServer", stub);
System.out.println("VidServer angemeldet");
fw.write("Hochgefahren: "
+ sdf.format(new Date(System.currentTimeMillis())));
} catch (Exception e) {
System.out.println("Da ist ein fehler");
fw.write("Fehler: " + e + " "
+ sdf.format(new Date(System.currentTimeMillis())));
}
/*
* while (true) { Update up = new Update(); up.abgleich();
*
* //bw.write("Update DB: "+ sdf.format(new
* Date(System.currentTimeMillis()))); //bw.flush(); }
*/
}
} catch (IOException e) {
System.out.println(e);
} finally {
if (fw != null)
try {
fw.close();
} catch (IOException e) {
}
}
}
}
ich will das die logs in die txt geschrieben werden ...
mfg[/code]