Logging function

The logging function is an optional extension that can be enabled for specific cycles. It outputs diagnosis information during cycle execution – either to the PLC, to a file, or to both destinations simultaneously.

The respective parameter section indicates whether the logging function is available for a specific cycle.

Logging is enabled by additional input parameters when the cycle is called. Internally, the sub-cycle SysUtilLog.ecy is used for this purpose. Logging adds to the runtime. It is therefore recommended to deactivate logging for production (@P200=0 or omit the parameter).

Operating principle

When logging is enabled, additional information is logged during cycle execution. This is particularly useful during start-up, troubleshooting and process optimisation. Each log output contains:

Depending on the mode selected, the log messages are sent to the PLC, written to a file, or both.

Caution: When the logging function is enabled, the command #FILE NAME is active until the end of the main program. If further #MSG SAVE commands follow without another #FILE NAME, the data continues to be written to the file specified in @P201.

Parameter

The logging function is controlled by two optional input parameters that can be specified in each cycle call.

Optional logging parameters

Input parameters

Description

@P200

Logging mode

0 = No logging (default) – no logging data is generated

"ALL" or 1 = Logging to PLC and to file – complete output

"PLC" or 2 = Logging only to PLC – output only to PLC interface

"FILE" or 3 = Logging only to file – output only to log file

Text values can also be combined, e.g. if **"PLC

@P201

is the filename for log output

Default: CncCycles.log

The filename is freely selectable to write various cycles to separate log files, for example.

@P202

0 = #FLUSH WAIT deactivated - The log message can be output during search decoding before the machine has physically reached the relevant point in the program.

1 = #FLUSH WAIT activated (default) - Forces a synchronisation between decoding and machine cycle. The log message is only output at precisely the moment when the machine runs through the code section in the main routine.

Log format

The log message consists of the following components:

Field

Description

Timestamp

Date and time of log entry

Cycle name

Name of active cycle that triggers the log entry (e.g. SysMeasWcs1)

Message

The actual informative text

The message is output in the text file as follows:

<timestamp> | <cycle_name> | <message>

The message is output in the PLC as follows:

<cycle_name> | <message>

Syntax of logging cycle

Logging is enabled by adding the parameter @P200 and optionally @P201 to the existing cycle call. No change is required in the cycle itself.

L CYCLE [NAME="<cycle_name>.ecy" \
        @P.. = ..                \
        @P200 = <mode>          \
        @P201 = "<filename>"    ]

Placeholders

Description

<cycle_name>

Name of the calling cycle (without path)

<mode>

Logging mode (0, 1 or "ALL", 2 or "PLC", 3 or "FILE")

<filename>

Desired name of log file

Programming example

Measurement cycle with complete logging

; measure workpiece with logging to PLC and file
L CYCLE [NAME="SysMeasWcs1.ecy"     \
        @P4  = V.L.MeasDistX        \
        @P7  = V.L.ZeroOffsetNumber \
        @P200 = "ALL"               \
        @P201 = "CncCycles.log"     ]

In this example, the measurement cycle SysMeasWcs1 is called. Complete logging is enabled by @P200="ALL" (to PLC and file). The log output is written to the file CncCycles.log.