This help topic looks at best practice for USoft logging in an event processing context. See also:
•Best practice for USoft modelling in an event processing context. •Best practice for USoft rules in an event processing context. •Best practice for USoft error handling in an event processing context. Logging is a fundamental part for analyzing and solving problems, especially on production systems. A well design logging system will save time for system administrators and developers. When designing a log system, it is important to think at who will read the logged information: a monitoring system, a developer, a non-technical person. In case of event processing systems, it is usual to have a monitoring system in place that will analyze log files from different perspectives (performance, errors, process status) and presents the information in a graphical form.
In USoft Service Framework you have two ways of adding messages to a log file.
You can use the default server/service log file. Service Framework uses log4j file format for its logging. You can configure logging for servers, services or classes. Each log file can be configured to have its own log level. See also Logging and tracing servers, services and classes.
You can use custom logging written to a different file. Service Framework is built on Java technology and it allows writing custom Java code. You can use Java to create your own custom logging.
|
In USoft Rules Engine you have different ways of adding messages to a log file.
You can use the Rules Service log file. All messages from constraints are added to the Rules Service log file by default. Messages from restrictive constraints are added as an error. Messages from corrective constraints are added as warning messages.
You can use the MessageLanguage method of the RulesEngine internal component to add messages to the Rules Service log file.
You can use custom logging written to a different file. Use the USFile internal component to add custom logging to a different file than the Rules Service default log file.
See USoft Definer Help for details on how to use RulesEngine and USFile components.
|
USoft is a model-based tool. You have the option of modelling a custom logging strategy in the database. Creating a logging strategy in the database gives you the possibility to query in a structured way (using SQL) for errors. You can also easily provide overview client/server screens on log information and add business rule logic to be executed on error.
Modelling a logging strategy also has disadvantages. It is slower than writing to file. It is less reliable: if the database connection is broken, the logging is gone.
In practice, the best solution is often a combination of logging to the database and logging to a file. Log the status of processed events to a database table dedicated to holding messages. This log status could indicate whether the item was new, successfully processed, processed with errors, and (if an error) what the problem was. This way, you can use SQL to trace and analyse errors, thus solving problems more easily.
|
See also
Event Processing
|