SysLog – Amiga system log daemon


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

SysLog – Amiga system log daemon

written by Peter Simons <simons@peti.GUN.de>

1 Copyright:

This software package is copyrighted in 1993 by Peter Simons, Germany and has been released under the concept of freeware. You’re encouraged to spread the archive as far as possible and to support SysLog in your own programs, even if they’re commercial.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2 “Standard Disclaimer”:

This product is meant for educational purposes only. Any resemblance to real persons, living or dead is purely coincidental. Void where prohibited. Some assembly required. List each check separately by bank number. Batteries not included. Contents may settle during shipment. Use only as directed. No other warranty expressed or implied. Do not use while operating a motor vehicle or heavy equipment. Postage will be paid by addressee. Subject to CAB approval. This is not an offer to sell securities. Apply only to affected area. May be too intense for some viewers. Do not stamp. Use other side for additional listings. For recreational use only. Do not disturb. All models over 18 years of age. If condition persists, consult your physician. No user-serviceable parts inside. Freshest if eaten before date on carton. Subject to change without notice. Times approximate. Simulated picture. No postage necessary if mailed in the United States. Breaking seal constitutes acceptance of agreement. For off-road use only. As seen on TV. One size fits all. Many suitcases look alike. Contains a substantial amount of non-tobacco ingredients. Colors may, in time, fade. We have sent the forms which seem to be right for you. Slippery when wet. For office use only. Not affiliated with the American Red Cross. Drop in any mailbox. Edited for television. Keep cool; process promptly. Post office will not deliver without postage. List was current at time of printing. Return to sender, no forwarding order on file, unable to forward. Not responsible for direct, indirect, incidental or consequential damages resulting from any defect, error or failure to perform. At participating locations only. Not the Beatles. Penalty for private use. See label for sequence. Substantial penalty for early withdrawal. Do not write below this line. Falling rock. Lost ticket pays maximum rate. Your cancelled check is your receipt. Add toner. Place stamp here. Avoid contact with skin. Sanitized for your protection. Be sure each item is properly endorsed. Sign here without admitting guilt. Slightly higher west of the Mississippi. Employees and their families are not eligible. Beware of dog. Contestants have been briefed on some questions before the show. Limited time offer, call now to insure prompt delivery. You must be present to win. No passes accepted for this engagement. No purchase necessary. Processed at location stamped in code at top of carton. Shading within a garment may occur. Use only in well-ventilated area. Keep away from fire or flame. Replace with same type. Approved for veterans. Booths for two or more. Check here if tax deductible. Some equipment shown is optional. Price does not include taxes. No Canadian coins. Not recommended for children. Prerecorded for this time zone. Reproduction strictly prohibited. No solicitors. No alcohol, dogs, or horses. No anchovies unless otherwise specified. Restaurant package, not for resale. List at least two alternate dates. First pull up, then pull down. Call toll free before digging. Driver does not carry cash. Some of the trademarks mentioned in this product appear for identification purposes only. Record additional transactions on back of previous stub. Decision of judges is final.

This supersedes all previous notices.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3 What is SysLog?

SysLog is a set of subroutines designed to help you to debug your programs. Several concepts for debugging output exist (one of them is the debug.lib, released by Commodore) and all of them have a few advantages and disadvantages.

I used a lot of them including self-written routines, but nothing was really satisfying at all. Then I found the SysLog package on the AmiNet which was appearently quite old and undocumented. However, I think this concept is the best and that’s why I decided to take the project over.

SysLog consists of two parts: A link library, containing the routines your programm should call, and a daemon, handling the debugging output. If your program jumps into the log-routine, an exec message is sent to the daemon’s port and control is handed back to the program immediatly. The daemon will receive the message and will print it out to the standard output it has been started from or to one or more logfiles. Thanks to this concept, the to-be-debugged program has not to perform the logging itself.

For example, the testprogram included in the ‘example/’ directory will produce the following output:

0780e018 start (CLI  Shell Process, SyslogTest)
0780e018: This is a nice and entertaining testmessage
0780e018: brought to you by syslog!
0780e018 end   (CLI  Shell Process, SyslogTest)
0780e018 quit  (CLI  Shell Process, syslogd) (done)

As you can see, the message is prefaced with the task id of the logger, to let you identify the task.

The big advantage of SysLog is, that all programs compiled with the debugging information use one logfile/output for their messages in cronologic order. So you can exactly determine what happened in what order.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4 Invoking the SysLog daemon:

The daemon is a program, running in the background and supplying the public message port the routines in the link library use.

You can control the daemon via the following commandline parameters:

SysLog [-hcrdlq] [filename...]
filename

When started, SysLog write the log to standard error channel per default. Additionally, the output can be written in up to three files, which can be specified at startup time.

Starting SysLog in another shell, when a copy is already installed, will submit the specified options or parameters to the already running process. If a new filename is specified it will be appended to the list of logfiles.

-h

This option prints a small usage table to the standard output.

-c<num>

This option tells SysLog to close file number <num> and to stop writing the log-output to it.

-d<num>

Temporarily disables the logging for file <num>.

-r<num>

Restart the logging for file <num>.

-l

Print a list of the current logfiles to the standard output.

-q

Tell the SysLog daemon to quit.

Here’s an exmaple for better understanding:

1> SysLog

Nothing special happens. Now type this in another shell:

2> SysLog T:Test
2> SysLog -l
File  0 FileHandle:  1e2b041 Flags: 00 Name: '*'
File  1 FileHandle:  1e2b04f Flags: 00 Name: 'T:Test'
File  2 FileHandle:        0 Flags: 00 Name: ''
File  3 FileHandle:        0 Flags: 00 Name: ''
2> SysLog T:Test2
2> SysLog -l
File  0 FileHandle:  1e2b041 Flags: 00 Name: '*'
File  1 FileHandle:  1e2b04f Flags: 00 Name: 'T:Test'
File  2 FileHandle:  1e2b051 Flags: 00 Name: 'T:Test2'
File  3 FileHandle:        0 Flags: 00 Name: ''
2> SysLog -d1
2> SysLog -c2
2> SysLog -l
File  0 FileHandle:  1e2b041 Flags: 00 Name: '*'
File  1 FileHandle:  1e2b04f Flags: 01 Name: 'T:Test'
File  2 FileHandle:        0 Flags: 00 Name: 'T:Test2'
File  3 FileHandle:        0 Flags: 00 Name: ''

Now type:

1> SysLog -q

and SysLog will terminate.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5 Adding SysLog support to your own programs:

A tried to make it as easy as possible to add the syslog routines into your own programs. The only thing you’ll need is the link library and appropiate include file, depending on you preferred language.

In C, just add

#include <syslog.h>

and

initsyslog()
.
.       /* your program */
.
uninitsyslog()

to your source code and you’re ready to use the syslog0() call. syslog0() requires the same parameters as C’s standard printf() or similar routines. In fact, it uses RawdoFmt() to handle the formatting. Whenever you like to have something logged just insert a function call to syslog0():

syslog0("Just opened the dos.library.\\n");
syslog0("The library base is 0x%lx.\\n", DOSBase);

In assembly language the usage is quiete similar:

INCLUDE "syslog.i"

jsr _InitSysLog
.
.       ; your program
.
jsr _UnInitSysLog()

To call syslog0(), you may use the SYSLOG-macro included in the assembly language include file as follows:

SYSLOG <"Just opened the dos.library.">
SYSLOG <"The library base is 0x%lx.">,(_DOSBase)

This macro add the newline at the end of the textline automatically for you. The parameters are pushed to the stack with the line:

move.l  \\1,-(SP)

To insert the contents of an address use the parameter like showed above, to push an address (or a constant) use:

SYSLOG <"The library base is stored in 0x%lx.">,#_DOSBase

The macro is only exanded in the program if the label DEBUG is set not equal to zero. Including ‘syslog.i’ sets DEBUG to 1 per default. You may debug only certain parts of your program with changing the value of debug depending on the part of the source:

DEBUG   set     1
.
.               ; buggy code
.
DEBUG   set     0

Now simply link the syslog.lib to your code, voilà!

ATTENTION: The library has been compiled with the SAVEDS feature of SAS/C 6.x. Therefore, the routines may be used by several different callers. However, due to this, you can’t link the library to pure code. I suggest you use normal code (c.o instead of cres.o) for the debugging phase.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6 How to contact me:

If you have any comments, enhancement requests or bug reports, or just want to chat, feel free to contact me (e-mail preferred), under one of the following addresses, e-mail preferred:

SnailMail: Peter Simons         E-Mail: simons@peti.GUN.de (Usenet)
           Europaring 20
           53123 Bonn 1          Voice: +49 228 746061
           Germany

[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated on February 6, 2023 using texi2html 5.0.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ < ] Back Previous section in reading order 1.2.2
[ Up ] Up Up section 1.2
[ > ] Forward Next section in reading order 1.2.4
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated on February 6, 2023 using texi2html 5.0.