Table of Contents

Name

marX.log - configuration file for logging of program "marX" for the

marXperts X-ray diffration systems

Description

Program marX drives X-ray diffraction systems. The program can be configured with one or more configuration files that will be read at program startup. One particular configuration file controls the logging behaviour. The configuration file follows the convention of Windows "ini" files with section names given in [brackets] and keywords and their values separated by the "equal" sign (=). All lines starting with # are ignored.

The program reads configuration files from the following locations in the given order (in parenthesis: Windows)

0step]
current_working_directory/marX.log (marX.log.ini)
0[step]
$HOME/.marX.log (%HOME%\marX.log.ini)
0[step]
$HOME/.local/share/MAR/marX.log (%APPDATA%\MAR\marX.log.ini)
0[step]
/usr/local/MAR/marX.log (%PROGRAMDATA%\MAR\marX.log.ini)

Entries given in the next available file will override all previous entries. This allows for mixing entries that can be changed by the user with entries set by a system administrator. The logging system is based on Python’s logging module. More detailed information can be obtained from: https://docs.python.org/3/howto/logging.html.

Example

A typical configuration file marX.log looks like:


[loggers]
keys=root,marX
[handlers]
keys=consoleHandler,fileHandler
[formatters]
keys=consoleFormatter,fileFormatter
[logger_root]
level=DEBUG
handlers=consoleHandler
[logger_marX]
level=DEBUG
handlers=consoleHandler,fileHandler
qualname=marX
propagate=0
[handler_consoleHandler]
class=StreamHandler
level=INFO
formatter=consoleFormatter
args=(sys.stdout,)
[formatter_consoleFormatter]
format=%(name)s: %(message)s
datefmt=%Y/%m/%d %H:%M:%S
[handler_fileHandler]
class=logging.handlers.RotatingFileHandler
level=DEBUG
formatter=fileFormatter
# args: (filename, mode, maxBytes, backupCount)
args=("/home/mar/.local/share/MAR/log/marX.log",’m’,1024*1024,99)
[formatter_fileFormatter]
format=%(asctime)s] [%(levelname)s] %(message)s
# format=[%(asctime)s] %(name)s::%(levelname)s: %(message)s
datefmt=%Y/%m/%d %H:%M:%S

Changeable Parameters

Most parameters should be left at their defaults. The only parameters that may be subject to changes are the location of the log files, the log file rotation and the criteria that apply to create a new version of the log file. Also the format of log strings and date strings may be changed.

In the example given above, the most likely line to be changed is:


args=("/home/mar/.local/share/MAR/log/marX.log",’m’,1024*1024,99)

The first argument is the full path name of the log file. You can choose any other location provided that the directory exists and is writable by the program that wants to use it. The 3rd argument (1024*1024) is the maximum number of bytes to which the log file may grow before a new version is created. Here, 1 MB is chosen (1024*1024 bytes). The last argument (99) is the maximum amount of file versions which the programs is going to handle before starting over. The latest version always is called marX.log, and all older files will be called marX.log.N with increasing N with increased age. Here, 99 versions will be stored (i.e. the oldest file marX.log.100 will be deleted).

See Also

marX, marXusers, marX.cfg

Author

Claudio Klein, Marxperts GmbH, Norderstedt, Germany

Copyright

© Copyright 2023 Marxperts GmbH, Norderstedt,

Germany

Address

MarXperts GmbHPhone: +49 - (40) - 529 884-0
Werkstr. 3 FAX: +49 - (40) - 529 884-20
D-22844 Norderstedt - GERMANYinfo@marXperts.com
www.marXperts.com


Table of Contents