I am currently having difficulties with an assignment, the assignment is to write a EntryLog class. The class diagram is as follows:
_____________________________________________________
LogEntry
--------------------------------------------------------------------------------------------
- dateStamp: DateTime //since that is deprecated, we can sub.
- filename: String
- message: String
---------------------------------------------------------------------------------------------
+ LogEntry(DateTime, String, String)
+ getDateStamp(): String
+ getFileName(): String
+ getMessage(): String
+ writeEntry(): void
---------------------------------------------------------------------------------------------

My instructor prefers that we use PrintWriter, all entries must be time stamped with the current date and time, and can not be changed for security reasons. We must test our class(not with JUnit, but with something along the lines of a println) and verify that it works correctly. That is where I seem to be having one of my problems. If I call my default constructor, nothing happens(nothing is wrote). If I call my custom constructor, the date and time don't print to the output file. Can someone please point out where I am going wrong, Google has too many different examples, by too many different programmers, and just a snippet of code here and there relating to what I am looking for. Here is my source for the LogEntry class:

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Calendar;
import java.util.Date;

import javax.swing.JOptionPane;
/*
* author: joe marinaccio
* date: 08/23/06
* file: LogEntry.java
* desc.: a class to write log entries to a text file,
* and that are time stamped.
*/
public class LogEntry{
private Date dateStamp = null;
private String filename = null;
private String message = null;

public LogEntry(){
//default
}

public LogEntry(Date dateStamp, String filename, String message){
this.dateStamp = dateStamp;
this.filename = filename;
this.message = message;
this.writeEntry();
}
public void writeEntry(){

try {
boolean exists = (new File("LogEntry.log")).exists();
if (exists) {
try {
boolean append = true;
PrintWriter pw = new PrintWriter(new FileWriter("LogEntry.log", append));
pw.print(dateStamp + " " + filename + " " + message + "\n");
pw.close();
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "error writing to log file\n" + e);
}
} else {
try {
@SuppressWarnings("unused")
File file = new File("LogEntry.log");
boolean append = true;
PrintWriter pw = new PrintWriter(new FileWriter("LogEntry.log", append));
pw.print(dateStamp + " " + filename + " " + message + "\n");
pw.close();
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "unable to create log file\n" + e);
}
}

} catch (Exception e) {
JOptionPane.showMessageDialog(null, "an error has occurred.\n" + e);
}
}
//accessors
public String getMessage(){
return message;
}

public String getFileName(){
return filename;
}

public Date getDateStamp(){
dateStamp = Calendar.getInstance().getTime();
return dateStamp;
}
}


Here is how I am trying to test it:

public class TestLogEntry {

public static void main(String[] args) {

LogEntry test1 = new LogEntry();
}

}

Any advice would be much appreciated, thanks in advance for your time.