AGG Software
Ask a question  Top  Previous  Next

Log rotation

The main function of Advanced PBX Data Logger is logging data to a file (so-called, log file). The "Log rotation" tab has a rich set of options for it. (fig. 4.1.1).

 

options logformat

Fig. 4.1.1 Log-file forming modes

 

First of all, select log file what you can configure:

 

Log file for data received - all data received will be saved here.
Log file for data sent - all data sent will be saved here. If you want to save data to the same file, as data received, then select the "Log file rotation for data sent" from the list and enable two options: "Create log files on disk" and "Write to log for data received". Yes, of course, you should configure a log rotation for data received before.

 

Set the "Create log file on disk" option to checked state. Then you can set path to folder, where files will be created with the help of dialog window, which will be showed up after clicking a button with picture of opening folder. You should select a necessary folder in the dialog window and click the "OK" button.

 

Note: The program can work with network paths too, but in this mode, the program will increase data flow over a network and can be failed with exceptional errors.

 

A log file name can be stamped with date and time. In this case a new log file is created periodically. The time stamp format depends on the selected period. For instance, if the "File name prefix" field is set to "sample", the "File extension" field to "log" and the "File name format" option is "Daily", then each log file created will have the format "sampleYYYYMMDD.log". On March 21st, 2003, the log file will be "sample20030321.log". Please, note, that the final extension (after the final period), remains at the end of the file name.

 

Log rotation mode is defined by the following key parameters:

 

File name prefix - text string, which will be added at file name beginning;
File name extension - text string, which will be a file extension (characters after dot);

 

Limit size - the "Limit size" field specify the maximum size in kilobytes of any log file. If you'll specify zero size, then the file size will not limited. You may select from the following modes:

1.Clear file - if the log file size will exceed the limit specified, then the log file content will be deleted and file filling will start from beginning.
2.Rename old - if the log file size will exceed the limit specified then the existing log file will be renamed.
3.Shift (no threshold) - the older data over the limit specified will removed from the log file.
4.Shift (with threshold). In this mode the program will wait when the file size will exceed the limit specified + the threshold value. After this, the older data over the limit specified will removed from the log file.

 

If the program works continuous for a long time, it is possible that the log file will have large size and this file will be inconvenient for looking and analysing. For this there is the possibility to create files in dependence with the time on PC. You can select one variant predefined or set up new one:

 

Daily - file will be created with name containing prefix, and date in format DDMMYYYY, where DD is two-digit day sign, MM is two-digit month sign and YYYY is four digits of the current year. The file name extension will be added at the end of file;
Monthly - file will be created with name containing prefix, and date in MMYYYY  format. The file name extension will be added at the end of file;
Each data packet in different file - in this mode the program splits data flow to a different file. In this mode you should configure the parser or the program will split a data by timeout about 300 ms.
Don't create new file - in this mode the program will write all data to one file. It is recommended for a small data flow. Otherwise your log file will be too big and a performance of the program will fall down;
User's format -  file will be created with name containing prefix and date in showed by you format (for example, DDMMYYYY). The file name extension will be added at the end of file. The file may not contain format signs, then file name will be constant. You should not use characters, that the OS doesn't allows in file name, such as "/,\.*,?" and some others;
Weekly - create a new file every week. The file name will contains a week number;
After data timeout -  the program will create a new file if the program didn't receive any data at the specified interval.
Hourly - file will be created with name containing prefix, and date in format YYYYMMDDHH, where HH is two-digit hour sign, DD is two-digit day sign, MM is two-digit month sign and YYYY is four digits of the current year. The file name extension will be added at the end of file;
Constantly named file - the current log file will have a constant name. When creating a new file the existing log file will be saved using the new file name that will contain a data and time stamp.

 

Date and time formatting codes:

 

d        - day, not adding null(1-31).

dd        - day ,adding null(01-31).

ddd        - day of the week in text form(Mon-Sat) according to standard, set on this computer.

dddd - day of the week in full text form(Monday-Saturday) according to standard, set on this computer.

m        - month, not adding null(1-12).

mm        - month, adding null (01-12).

mmm  - month in text form(Jan-Dec) according to standard, set on this computer.

mmmm - month in full text form (January- December) according to standard, set on this computer.

yy        - year in the form of two last digits(00-99)

yyyy        - year in the form of four last digits (0000-9999).

h        - hours, not adding null (0-23).

hh        - hours, adding null (00-23).

n        - minutes, not adding null (0-59)

nn        - minutes, adding null (00-59).

s        - seconds, not adding null (0-59).

ss        - seconds, adding null (00-59).

 

Example: you want to create log file every hour. It is desired that file name starts from "sample_log" and the file extension "txt".

 

Answer: set file prefix = sample_log_, file extension= txt (without dot!). In file name format show HHDDMMYYYY. Now file will be created every hour. Naturally, you can set any formatting characters combination, described higher.

 

If you want to access to a log file while the program work, then you should configure access mode settings for the log file in the next chapter.

 

Add date/time stamp to file name - this option is available for modes #4 and #7 and allows to add date and time to the file name.

 

Add data source ID to file name - if this options is activated then then the program will append the data source name at the beginning of the file name. For example, COM1-sample20030321.log.

 

Write data/time stamp to file before writing data - if this options is activated then then the program will write a date/time stamp to a file before each data portion.

 

Overwrite existing files - this option is available for modes #4 and #7 and allows to delete an existing log file before creating a new log file.




Copyright © 1999-2016, AGG Software.
All rights reserved.