RL01 Pattern Log Reader
With the pattern log reader, you can read line based logs containing multiple line patterns. With the help of regular expressions, all relevant information can be extracted and read into struct signals. This article will help you configure and use the reader.
About pattern logs
In most cases, developers have text log outputs. In the good case, all log line share the same format, but often there is a strange mix of multiple line pattern due to historical reasons.
Up to a certain level, impulse can parse these mixed logs and present and analyze them in a uniform
To achieve this, the user can define a set of pattern. Each pattern describes the format and content of one line type.
Here a typical log example:
NOTE [212 745 133.974 ns] in top.mDist_dsp_access.r2_op : getX4LegChangeDone happened WARNING [212 745 133.974 ns] in top.mDist_dsp_access.r4_op : getX4LegChangeDone ISR at 214435176 ERROR [214 435 176.000 ns] in top.mDist_dsp_wait : Kernel changed state to: OUTPUT # Leg ok - wait for next NOTE00000[216 735 876.000 ns] in top.F4.generics : Calculated load 47%
The reader can be used to open workspace resources and together with ports (direct connection to the target using TCP, Serial, J-Link, ...).
The Pattern Log Reader requires a configuration (Pattern Log Configuration) to work. Each configuration contains a set of log pattern. Click the Add button to add a new "Pattern Log Configuration" and fill in the following parameters:
- Char Set: Select the char set that is used by the log file.
- Domain Base: Select the domain base. This represents is smallest domain change (e.g. 1 ms).
- Match pattern: This settings define one of your pattern as the one used to match with a given file. If the given pattern matches the first line of the file, the configuration is used to read the file.
Press "Add" and select "Log Pattern" to create a new pattern.
You can define multiple pattern (e.g. you may have different log styles from different units). When reading, it takes the first pattern that matches. Use the buttons on the right side to re-order your patterns.
The log pattern dialogue shows the following parameters:
- Pattern: Define the regular expression for the lines. Use the context proposals (press control-space). For more information about java regular expressions see http://docs.oracle.com/javase/tutorial/essential/regex/
- Test Lines: You may add a few lines of your log file. Press "Test" to validate against your expression.
First step is done. Now you need to define what to do with the extracted attributes.
- Select the action.
- Ignore : Just skip the line
- Create new log sample
- Append to previous sample: The information will be added to the previous event (e.g. from previous line).
- Select the member names. You can select a predefined member or enter a custom one.
- For custom members you can define the signal type and a descriptor.
- Define the domain value (time-stamp):
- Date: you need to define the date format. Use content proposals and http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html.
- Float execution time: Parse a float value, optionally let it to parse the time unit from the file or assign a unit.
- Integer execution time: Parse an integer value, optionally let it to parse the time unit from the file or assign a unit.
- Define the naming:
- Default name : All log events get into one signal with the name "log".
- Name from group value : The given value is taken to define the signal name. The log events will be stored into different signals.
- Hierarchy from group value : Similar to the previous one. The difference is that the value is split up (hierarchy separator) and the signal is embedded into a hierarchy of logs.
Now you are ready with the reader configuration. Please have in mind that the standard file extension for pattern logs is ".log". To change ,please use the Preferences -> General -> Content Types -> (Element/Record/Pattern Log Record).
The reader will provide a parse error message if the input can not be read. The message usually contains the error position, the reason for the failure and a stack trace.
Reader: de.toem.impulse.serializer.xyz Error at position: 4800 Text at position: "o !. Up Uq Ur" Message: Invalid character Type: class de.toem.impulse.serializer.ParseException Stack trace: de.toem.impulse.serializer.xyz.xyzReader.parse(XYZReader.java:459) de.toem.impulse.serializer.xyz.xyzReader.parse(xyzReader.java:363) de.toem.impulse.serializer.xyz.xyzReader.read(xyzReader.java:269) de.toem.impulse.serializer.xyz.xyzReader.read(xyzReader.java:237) de.toem.pattern.element.Element$1.execute(Element.java:1063) de.toem.eclipse.hooks.actives.EclipseActives$3.run(EclipseActives.java:73)