Home > Archive > Cobol > January 2005 > Cobol's having a social event...
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Cobol's having a social event...
|
|
| Kellie Fitton 2005-01-24, 8:55 pm |
| Hello everyone,
when using the win32 API "OpenEventLog", I need to provide the
name of the Event LogFile to open -- so, can I make my own event
logfile name? If so, is there a Standard Format for naming these
event logfiles (eventlog.log)? Also, if the event logfile name
is not provided, the function will use the "Application" logfile,
is that a default logfile for my cobol application, or these are
the windows's registry's event logfile?
I am using Net Express 3.1 with Windows 2000 professional.
thanks for the feedback and kind help as usual, kellie.
| |
| Robert Wagner 2005-01-25, 3:55 am |
| On 24 Jan 2005 15:07:10 -0800, "Kellie Fitton"
<KELLIEFITTON@YAHOO.COM> wrote:
>Hello everyone,
>
>when using the win32 API "OpenEventLog", I need to provide the
>name of the Event LogFile to open -- so, can I make my own event
>logfile name? If so, is there a Standard Format for naming these
>event logfiles (eventlog.log)? Also, if the event logfile name
>is not provided, the function will use the "Application" logfile,
>is that a default logfile for my cobol application, or these are
>the windows's registry's event logfile?
>I am using Net Express 3.1 with Windows 2000 professional.
>thanks for the feedback and kind help as usual, kellie.
The Event Log is a structured file, not an ASCII text file, into which
you log event NUMBERS. It is viewed with program eventvwr, which
supplies message text from a message file. If you'll run eventvwr,
you'll see what they mean by "the Application logfile". Its location
is defined in your registry at:
HKEY_LOCAL_MACHINE\System\CurrentControl
Set\Services\Eventlog\Application
Note the definitions of the Security and System logs under Eventlog.
Note well all the applications under Application, each having an
EventMessageFile.
Custom logs can be registered under Eventlog and opened with
OpenEventLog(pointer to logname in registry, not file name). However,
the more normal way is to register your application as yet another
'source' for the Application log.
You can register your application two ways: by editing the registry
with regedit or by using AddEventSource() et seq. as shown here:
http://msdn.microsoft.com/library/d...he_registry.asp
You do that once, typically during installation. During program
execution, use RegisterEventSource() followed by ReportEvent ending
with DeregisterEventSource.
If all you want is an ASCII file, use DISPLAY ... UPON SYSERR and
direct it to a file of your choice with 2>filename.
| |
| Kellie Fitton 2005-01-25, 3:55 am |
|
Robert Wagner wrote:
> The Event Log is a structured file, not an ASCII text file, into
which
> you log event NUMBERS. It is viewed with program eventvwr, which
> supplies message text from a message file. If you'll run eventvwr,
> you'll see what they mean by "the Application logfile". Its location
> is defined in your registry at:
>
HKEY_LOCAL_MACHINE\System\CurrentControl
Set\Services\Eventlog\Application
> Note the definitions of the Security and System logs under Eventlog.
> Note well all the applications under Application, each having an
> EventMessageFile.
>
> Custom logs can be registered under Eventlog and opened with
> OpenEventLog(pointer to logname in registry, not file name). However,
> the more normal way is to register your application as yet another
> 'source' for the Application log.
>
> You can register your application two ways: by editing the registry
> with regedit or by using AddEventSource() et seq. as shown here:
>
http://msdn.microsoft.com/library/d...he_registry.asp
>
> You do that once, typically during installation. During program
> execution, use RegisterEventSource() followed by ReportEvent ending
> with DeregisterEventSource.
>
> If all you want is an ASCII file, use DISPLAY ... UPON SYSERR and
> direct it to a file of your choice with 2>filename.
Kellie Wrote:
thanks for the feedback, Robert.
Regards.
| |
| Richard 2005-01-25, 3:55 am |
| > with 2>filename.
Or possibly 2>>filename
| |
|
| I've never been successful with the event log using the native Windows
API calls. However, if you are using Fujitsu COBOL you can get
information logged into the event log. The biggest "bugaboo" with the
whole thing are the registry entries required to allow an application
to WRITE to the event log. Fujitsu COBOL provides a tool to allow you
to enter this information into the registry and it makes all the
necessary entries. It's called: COBSETTER.EXE. After using it (in
conjunction with the documentation) you can do the following in your
COBOL program (Taken from a functioning system)
move 2 to event-log-type
move spaces to event-log-message
if message-length > zeros
string "Service Terminated, Error Opening Com Port,
Windows returns: "
message-text (1:message-length) delimited by
size
into event-log-message
end-string
else
move win32api-return-value to ed-value
string "Service Terminated, Error Opening Com Port,
Windows returns error number: "
ed-value delimited by size
into event-log-message
end-string
end-if
perform log-event
log-event.
move low-values to data-name-1
move event-log-number to event-number
move event-log-type to event-type
move event-log-message to description
move "Data Acquisition Server" to source-name
if server-number not = zeros
move server-number to source-name (25:1)
move low-values to source-name (26:1)
end-if
call "COB_REPORT_EVENT" using data-name-1
returning data-name-2
end-call
if event-log-type = 2 and
(email-on-completion or email-on-error)
move event-log-message to use-message
perform send-email-message
end-if
..
The "Source name" - in this case "Data Acquisition Server" has to be in
the registry via the COBSETTER routine.
I realize this doesn't help for non Fujitsu users, but I learned the
hard way that there is a lot mroe to it than just using the API's for
the event log. There is a lot of infrastructure that needs to exist as
well.
| |
| Kellie Fitton 2005-01-26, 3:55 pm |
|
Thane wrote:
> I've never been successful with the event log using the native
Windows
> API calls. However, if you are using Fujitsu COBOL you can get
> information logged into the event log. The biggest "bugaboo" with
the
> whole thing are the registry entries required to allow an application
> to WRITE to the event log. Fujitsu COBOL provides a tool to allow
you
> to enter this information into the registry and it makes all the
> necessary entries. It's called: COBSETTER.EXE. After using it (in
> conjunction with the documentation) you can do the following in your
> COBOL program (Taken from a functioning system)
>
> move 2 to event-log-type
> move spaces to event-log-message
> if message-length > zeros
> string "Service Terminated, Error Opening Com Port,
> Windows returns: "
> message-text (1:message-length) delimited by
> size
> into event-log-message
> end-string
> else
> move win32api-return-value to ed-value
> string "Service Terminated, Error Opening Com Port,
> Windows returns error number: "
> ed-value delimited by size
> into event-log-message
> end-string
> end-if
> perform log-event
>
>
> log-event.
> move low-values to data-name-1
> move event-log-number to event-number
> move event-log-type to event-type
> move event-log-message to description
> move "Data Acquisition Server" to source-name
> if server-number not = zeros
> move server-number to source-name (25:1)
> move low-values to source-name (26:1)
> end-if
> call "COB_REPORT_EVENT" using data-name-1
> returning data-name-2
> end-call
> if event-log-type = 2 and
> (email-on-completion or email-on-error)
> move event-log-message to use-message
> perform send-email-message
> end-if
> .
>
> The "Source name" - in this case "Data Acquisition Server" has to be
in
> the registry via the COBSETTER routine.
>
> I realize this doesn't help for non Fujitsu users, but I learned the
> hard way that there is a lot mroe to it than just using the API's for
> the event log. There is a lot of infrastructure that needs to exist
as
> well.
Kellie Wrote:
thanks thane. However, for my level though, I think using the win32 API
functions in micro focus cobol -- is much easier than in fujitsu as
you
have pointed out above. Regards.
Kellie.
|
|
|
|
|