Desktop User Guides > Professional > Data management scripting > Data Management Script (DMS) file > Sections in the DMS file > Logging section
 
Logging section
The Logging section defines the parameters for the Logging component and specifies that you want logging to be performed when the DMS file is executed. This section is optional. However, if you do not specify a Logging section, no logging will be performed. A DMS file should not contain more than one Logging section.
Syntax
Logging(<name> [, "<description>"])
  Group = "<group>"
  Path = "<path>"
  Alias = "<alias>"
  [FileSize = <file_size>]
End Logging
Parameters
name and description
A name and description for the section and should be of type Text.
<group>
The application group that writes the log and controls the first three characters of the log filenames.
<path>
The location of the log file. You can specify a full path or a relative path (relative to the location of the DMS file), such as “MyLogs”. However, the “..” notation (for example, ..\..\MyLogs) is not valid. The log file has a .tmp filename extension.
<alias>
Aname to be used in the logging file. This means you can identify the logs that originated in this DMS file when multiple clients are using the same log file.
<file_size>
The maximum size of the log file. The default maximum size is 100 KB.
Notes
Include a Logging section in all your DMS files, so that any records that fail validation are written to the log file. For more information, see Validation options when transferring data.
The log filenames are constructed from the first three characters defined in the <group> parameter with the addition of two or more characters to make the name unique and a .tmp filename extension.
Example
The following example shows a DMS file that contains a Logging section that sets the logging group to “DMGR”, the folder for the log file, an alias name of “Tester”, and a maximum file size of 500KB.
The example also shows using the log file to record data cleaning information. In the OnNextCase Event section a string is set up and the Log.LogScript_2 method is called to write the string to the log file.
Logging(myLog)
Group = "DMGR"
Path = "c:\temp"
Alias = "Tester"
FileSize = 500
End Logging

InputDataSource(Input)
ConnectionString = "Provider=mrOleDB.Provider.2; _
Data Source=mrDataFileDsc; _
Location=C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Data\Data Collection File\museum.ddf; _
Initial Catalog=C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Data\Data Collection File\museum.mdd"
SelectQuery = "SELECT Respondent.Serial, visits, before FROM VDATA WHERE Respondent.Serial < 101"
End InputDataSource

OutputDataSource(Output)
ConnectionString = "Provider=mrOleDB.Provider.2; _
Data Source=mrDataFileDsc; _
Location=C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Output\Logging.ddf"
MetaDataOutputName = "C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Output\Logging.mdd"
End OutputDataSource

Event(OnNextCase, "Clean the data")
Dim strDetails
strDetails = CText(Respondent.Serial)

If visits is not Null then
If visits = 0 Then
before = {No}
strDetails = strDetails + " Before = No"
Else
before = {Yes}
strDetails = strDetails + " Before = Yes"
End If
Else
before = {No}
strDetails = strDetails + " Before = No"
End If

dmgrJob.Log.LogScript_2(strDetails)
End Event
This example is provided as a sample DMS file (called Logging.dms) that is installed with the UNICOM Intelligence Developer Documentation Library. For more information, see Sample DMS files.
You can use Log DSC to read and query log files. Here is the log file viewed in DM Query using Log DSC.
This graphic is described in the surrounding text.
See
Sections in the DMS file