Created
November 29, 2010 10:13
-
-
Save bussiere/719789 to your computer and use it in GitHub Desktop.
a tiny tools for debugging in java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Write String a the end of a file | |
package outils; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.util.Date; | |
public class LogDebug | |
{ | |
public static void ecrire(Object debug) | |
{ | |
FileWriter writer = null; | |
try{ | |
writer = new FileWriter("log.txt", true); | |
Date maDate = new Date(); | |
String ecrituredebug = maDate.toString()+":"+debug.toString()+"\r\n"; | |
writer.write(ecrituredebug,0,ecrituredebug.length()); | |
}catch(IOException ex){ | |
ex.printStackTrace(); | |
}finally{ | |
if(writer != null){ | |
try | |
{ | |
writer.close(); | |
} | |
catch (IOException e) | |
{ | |
} | |
} | |
} | |
//System.out.println(debug); | |
} | |
public static void ecrire(String fichier,Object debug) | |
{ | |
FileWriter writer = null; | |
try{ | |
writer = new FileWriter(fichier, true); | |
Date maDate = new Date(); | |
String ecrituredebug = maDate.toString()+":"+debug.toString()+"\r\n"; | |
writer.write(ecrituredebug,0,ecrituredebug.length()); | |
}catch(IOException ex){ | |
ex.printStackTrace(); | |
}finally{ | |
if(writer != null){ | |
try | |
{ | |
writer.close(); | |
} | |
catch (IOException e) | |
{ | |
} | |
} | |
} | |
//System.out.println(debug); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment