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 = FileSize
End Logging
Parameters
name and description
A name and description for the section and should be of type Text. The following table describes the parameters that you can set within the section.
Group
Defines the application group that writes the log and controls the first three characters of the log filenames.
Path
Defines 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 (such as ..\..\MyLogs) is not valid. The log file will be created in this folder with a .tmp filename extension.
Alias
Defines a name 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.
FileSize
Defines the maximum size of the log file. If you do not specify this parameter, the maximum size defaults to 100 KB.
Notes
It is generally a good idea to have a Logging section in all your DMS files, as any records that fail validation will then be 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
Note 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.
See also
Sections in the DMS file