Control the logfile outputs
iPlus offers you three types of logging options for diagnostic and analytical purposes:
- Logging of errors, exceptions and trace output
- Long-term storage of process variable/properties
- Performance measurements
for 1.) logging of errors, exceptions, trace outputs:
For this you need the configuration classes from the namespace "gip.core.autocomponent"
- LoggingConfiguration <LoginConfiguration>
- LogFileElement <addLogfile> + LogFileCollection <LogFiles>
- LoggingTypeElement <addLoggingType> + LoggingTypeCollection <LoggingTypes>
Example:
The <addLoggingType> element is used to define a file type or filter rules that specifies which message types and from which automation components are to be written to a file. You then refer to this file type in the <addLogFile> element via the attribute "FileType". With <addLogFile> you define the log file to be written.
Attributes/properties of <addLoggingType> :
- FileType: A freely assignable name that is referenced in <addLogFile>.
- MessageType: Specifies the message type to be logged to. The following values are possible which are defined in the Enumerator gip.core.datamodel.eMsgLevel: Default, Debug, Info, Warning, Failure, Error, Exception, Command, Status, Statusdetail, Question. If Default is specified, then all message types are logged.
- Source: Specifies the ACUrl of a component to be logged specifically. If Default is specified, the messages are output from all components.
Attributes/properties of <addLogFile> :
- FileType: Specifies which file type or filter rule to use.
- FileName: Format command for the file name to be created. For the placeholder %Date% the current timestamp is entered, for the placeholder %ProcessId% for the current process ID. Logfiles are written exclusively to the temporary user directory (%userprofile%\AppData\Local\Temp). Another path cannot be specified.
- MaxSizeMB: Maximum log file size in MB. If the file size is exceeded, a new file is created and the counter is increased. The counter is always set at the end before the file name extension. E.g. ...3.txt.
- ArchiveAfterDays: After this time period, old log files are zipped automatically. If 0 is specified, no archiving takes place.
to 2.) Long-term storage of process variables/properties
The setting which variable is to be logged is made in the property tab in the iPlus development environment. A separate database file is created monthly for each variable (https://en.wikipedia.org/wiki/Extensible_Storage_Engine). Old archives are automatically deleted after three months. If you want to extend this default setting, the DeletePropLogAfterXMonths property must be defined in the LoggingConfiguration class and the value must be specified in months.