Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Date;
- import java.io.IOException;
- import java.io.FileWriter;
- import java.text.SimpleDateFormat;
- public class Bla {
- public static void main(String[] args) {
- Date date = new Date();
- SimpleDateFormat form = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss z");
- String mes = "\n" + form.format(date);
- System.out.println(mes);
- try {
- FileWriter logger = new FileWriter("server.log", true);
- logger.write(mes);
- }
- catch (IOException e) {
- System.err.println(e);
- }
- }
- }
Add Comment
Please, Sign In to add comment