Event Viewer Application Log


Accessing the Application Log Using Windows NT

To open the Application Log:

  1. Open the Event Viewer by selecting

    Start Programs Administrative Tools Event Viewer

  2. Select

    Log Application

An alternate method of starting the Event Viewer is to type eventvwr in the Run dialog box and click OK .

Accessing the Application Log Using Windows 2000 and Windows Server 2003

Using Windows 2000, you access the Application Log from the Event Viewer tree view:

  1. Select

    Start Settings Control Panel

  2. Double-click Administrative Tools .

  3. Double-click Event Viewer .

  4. In the Tree view, select Application Log .

An alternate method of starting the Event Viewer is to type eventvwr in the Run dialog box and click OK .

Accessing the Application Log Using Windows XP

Using Windows XP, you access the Application Log from the Event Viewer tree view:

  1. Select

    Start Control Panel

  2. Double-click Administrative Tools .

  3. Double-click Event Viewer .

  4. In the Tree view, select Application Log .

An alternate method of starting the Event Viewer is to type eventvwr in the Run dialog box and click OK .

Viewing a SAS Event

If a SAS task ends abnormally, information regarding the task is placed in the Application Log. The Source column shows 'SAS' as the event source. Messages from SAS/CONNECT display 'SAS Job Spawner' as the event source. Double-clicking a SAS event opens the Event Properties window (the Event Detail window under Windows NT) that contains information about the event.

Sending Messages to the Application Log Using a User -Written Function

Specifying the Function's First Parameter

SAS events can be sent to the Application Log by using a user-written function in either SAS code or SAS Component Language (SCL). Input to the function is a specific text string. This text string corresponds to the type of event and to the text string that will appear in the Event Viewer:

 yourfunction("type_of_event", "text_string"); 

The following table lists the types of events that are available for the first parameter.

Table 9.1: Types of SAS Events

Type of Event

First Parameter Value

Error

'ERROR'

Warning

'WARNING'

Information

'INFORMATION'

Success Audit

'SUCCESSAUDIT'

Failure Audit

'FAILUREAUDIT'

Although the first parameter values that are displayed in the table are shown in uppercase, mixed case is also allowed. The second parameter of the function is a string that will appear in the Windows Event Viewer.

Examples of Using the User-Written Function to Write to the Event Log

In the following example, the existence of a semaphore file is checked before SAS performs lengthy processing:

 %macro pdata(file);      %let cmdstr = "dir &file";      options noxwait;      data _null_;         call system(&cmdstr);      run;      %put &sysrc = sysrc;      %put &file;      %if &sysrc=0 %then %do;         filename indata "&file";         /* Your data step code for this file. */         DATA a;            infile indata length=linelen;            length line $ 200;            input @1 line $ varying200. linelen;         PROC print;         run;      %end;      %else %do;         /*  Log an Event of type Error. */         %let cmdstr = %str("The file &file did not exist                                so no data step ran.");         %put &cmdstr;         DATA _null_;            x=ntlog("INFORMATION",&cmdstr);         run;      %end;   %mend;  %pdata(c:\config.syss) 

The following is SCL code to write to the Application Log:

 /* Build a frame and add a pushbutton.  Change the Attribute  Name ''name'' to ''object1''.  In the Source window, add the  following code. */  object1:  x=ntlog("INFORMATION", "This is an INFORMATION event.");  x=ntlog("WARNING", "This is a WARNING event.");  x=ntlog("ERROR", "This is an ERROR event.");  x=ntlog("SUCCESSAUDIT", "This is a SUCCESSAUDIT event.");  x=ntlog("FAILUREAUDIT", "This is a FAILUREAUDIT event.");  return; 

Sending Messages to the Application Log Using LOGEVENT.EXE

Using the Windows LOGEVENT.EXE utility that is provided by the Windows Resource Kit, you can send your own information messages to the Application Log from within SAS code.

In the following example, the existence of a semaphore file is checked before SAS performs some lengthy processing.

 %macro pdata(file);     %local cmdstr;     %let cmdstr = "dir &file";     options noxwait;     DATA _null_;        call system(&cmdstr);     run;     %if &sysrc=0 %then %do;        filename indata "&file";        /* Your data step code for this file. */        DATA a;           infile indata length=linelen;           length line $ 200;           input @1 line $ varying200. linelen;        PROC print;        run;     %end;     %else %do;        /*  Log an Event of type Error.  */        %let cmdstr = %bquote(c:\support\sasset2\logevent.exe -s E        "The file &file did not exist so no data step ran.");        DATA _null_;           %sysexec &cmdstr;        run;     %end;  %mend;  %pdata(c:\config.syss) 

When you double-click the event in the Application Log, the Event Properties window (the Event Details window under Windows NT) will display the message in the Description box.

click to expand
Display 9.1: Displaying a User Message in The Event Detail Dialog Box

For information about LOGEVENT.EXE, see the documentation for the Windows Resource Kit.




SAS 9.1 Companion for Windows
SAS 9.1 Companion for Windows (2 Volumes)
ISBN: 1590472004
EAN: 2147483647
Year: 2004
Pages: 187

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net