Simple Java application with Audit file.

Hi all, today I have come up with new simple application based on one of my blog referee’s request.

He asked me to code a simple application that will handle audit file. Normally I do not do anyone’s assignments but this done because I didn’t know how to do it in java. So finally I did it. See the code and explanation on the source code for more details.

This is very simple application that will record the every process of the application (login, button click, etc…) to .dat file. In a big project this will very helpful. I did not use any data encryption method  here.

This is the audit file handling class

 * To change this template, choose Tools | Templates
 * and open the template in the editor.

package simpleaudit;

 * @author Developer
public class Audit{  // this is the start audit class

    public void auditIt(String message) throws ClassNotFoundException // method declaration


      BufferedWriter bw = null;

      try {

	  //this pease of code i got from

         bw = new BufferedWriter(new FileWriter("checkbook.dat", true)); // create a new object
	 bw.write(message); // passed the audit message
	 bw.newLine(); //print new line after each statement
	 bw.flush(); // flush the buffer after enter audit details.


      catch (IOException ioe)


	 if (bw != null) try

         catch (IOException ioe2)





see the netbeans project for complete code.

Download the Project 

5 thoughts on “Simple Java application with Audit file.

  1. did you ever heard about log4j. Apache log4j is a Java-based logging utility. i Think you should follow this method cuz Apache log4j is interesting framework for keeping logging statement.

  2. Dear Damith,

    When i make jar file for netbeans project, jasper reports are not working via jar.what is the reason for that? Please help me.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.