Hello Event Log

A simple console program with eventlog.


Introduction

A simple console program to show usage of Event Log.


1. Edit a java source file: "X:\demos\src\hello\eventlog\DemoEventLog1.java"

package hello.eventlog;

import com.regexlab.j2e.EventLog;

public class DemoEventLog1 {

    public static void main(String[] args) {
       
        // new an instance of EventLog
        EventLog event = new EventLog();
       
        // to add a log
        event.reportEvent(EventLog.INFORMATION, (short)1, 1, "This is DemoEventLog1");
       
        System.out.println("ReportEvent finished.");
       
    }

}

2. Enter "X:\demos" directory and compile it to a class file:

X:\>cd demos
X:\demos>javac -cp lib/jar2exe_integrate.jar src/hello/eventlog/DemoEventLog1.java

3. Make a jar file:

X:\demos>jar -cvf demoeventlog1.jar -C src .

4. Use Jar2Exe to generate exe file for Windows only:

X:\demos>j2ewiz demoeventlog1.jar /m hello.eventlog.DemoEventLog1 /eventlog

The Event Log supports Windows only.

5. Download the program for reference.


See Also

  • See Event Log page for more details about Event Log.