Differences

This shows you the differences between the selected revisions of the page.

2014-12-19 2015-02-17
checksum is beta (martin) limit XML acronym recognition + articles (martin)
Line 1: Line 1:
====== XML Logging ====== ====== XML Logging ======
-XML logging is one of the WinSCP [[logging|log formats]]. XML log includes structured records describing operations done by WinSCP over session. The log format is protocol independent.+XML logging is one of the WinSCP [[logging|log formats]]. An %%XML%% log includes structured records describing operations done by WinSCP over session. The log format is protocol independent.
-In many cases you do not have to deal with the XML log file directly. [[library|WinSCP .NET assembly]] can do it for you.+In many cases you do not have to deal with the %%XML%% log file directly. [[library|WinSCP .NET assembly]] can do it for you.
===== Purpose ===== ===== Purpose =====
Primary purpose of the XML logging is to provide machine-readable description of automatically performed operations, such as when using [[scripting|scripting]]. Primary purpose of the XML logging is to provide machine-readable description of automatically performed operations, such as when using [[scripting|scripting]].
-XML logging is useful e.g. to:+The %%XML%% logging is useful e.g. to:
  * Find a list of files that were actually uploaded/downloaded, when transferring whole directory or files matching a mask;   * Find a list of files that were actually uploaded/downloaded, when transferring whole directory or files matching a mask;
  * Get directory listing;   * Get directory listing;
  * Record operations done during [[task_synchronize_full|synchronization]].   * Record operations done during [[task_synchronize_full|synchronization]].
-Note that while the XML logging can be used also for GUI sessions, it does not record a [[transfer_queue|background transfers]].+Note that while the %%XML%% logging can be used also for GUI sessions, it does not record a [[transfer_queue|background transfers]].
===== Using ===== ===== Using =====
-XML logging, being used along with [[scripting|scripting]], is most typically enabled from [[commandline|command-line]], using ''/xmllog'' parameter. It can be enabled in [[ui_pref_logging|preferences]] too.+The %%XML%% logging, being used along with [[scripting|scripting]], is most typically enabled from [[commandline|command-line]], using ''/xmllog'' parameter. It can be enabled in [[ui_pref_logging|preferences]] too.
-Overall format of the XML log file follows:+An overall format of the %%XML%% log file follows:
<code xml> <code xml>
Line 27: Line 27:
</code> </code>
-The top level ''session'' tag represents one logical session, which may consist of several physical sessions, particularly when connection is lost. Attribute ''name'' refers to name of the logical session. Attribute ''start'' indicates time when the session was initiated ((All timestamps in XML log have XML ''dateTime'' type, where only ''%%YYYY-MM-DD"T"HH:MM:SS.NNN"Z"%%'' syntax is used.)).+The top level ''session'' tag represents one logical session, which may consist of several physical sessions, particularly when connection is lost. Attribute ''name'' refers to name of the logical session. Attribute ''start'' indicates time when the session was initiated ((All timestamps in the %%XML%% log have %%XML%% ''dateTime'' type, where only ''%%YYYY-MM-DD"T"HH:MM:SS.NNN"Z"%%'' syntax is used.)).
The ''session'' element includes [[#elements|child elements]], where each element represents single log entry, i.e. single physical operation with remote file over the logical session. The ''session'' element includes [[#elements|child elements]], where each element represents single log entry, i.e. single physical operation with remote file over the logical session.
===== [[operations]] Representing Operations in Log ===== ===== [[operations]] Representing Operations in Log =====
-Every entry in XML log represents single physical operation over the session. Typically this would be an operation with remote file.+Every entry in the %%XML%% log represents single physical operation over the session. Typically this would be an operation with remote file.
Single logical operation (in [[scripting|scripting]] or GUI) may actually involve multiple physical operations, each represented with separate log element. For example [[task_upload|upload]] of file (e.g. using ''put'' scripting command) may be represented by up to three elements, ''upload'' for actual upload, ''touch'' for preserving timestamp and ''chmod'' for preserving permissions. Single logical operation (in [[scripting|scripting]] or GUI) may actually involve multiple physical operations, each represented with separate log element. For example [[task_upload|upload]] of file (e.g. using ''put'' scripting command) may be represented by up to three elements, ''upload'' for actual upload, ''touch'' for preserving timestamp and ''chmod'' for preserving permissions.
-Note that some logical operations does not have corresponding log element (e.g. [[task_link|creation of symbolic link]]). Such operations are omitted from the XML log.+Note that some logical operations does not have corresponding log element (e.g. [[task_link|creation of symbolic link]]). Such operations are omitted from the %%XML%% log.
===== [[result]] Representing Results/Errors ===== ===== [[result]] Representing Results/Errors =====
Line 60: Line 60:
</code> </code>
-With some protocols, each of the physical operations are performed individually. With some protocols, set of operations may be performed in atomic form. This may prevent mapping error to specific operation. In this case the error may be associated with more operations, resulting in its duplication in the XML log.+With some protocols, each of the physical operations are performed individually. With some protocols, set of operations may be performed in atomic form. This may prevent mapping error to specific operation. In this case the error may be associated with more operations, resulting in its duplication in the %%XML%% log.
Some errors may not be associated with any operation in the XML log. This particularly happens when: Some errors may not be associated with any operation in the XML log. This particularly happens when:
Line 92: Line 92:
===== [[group]] Grouping Operations for Commands ===== ===== [[group]] Grouping Operations for Commands =====
-When using XML logging together with [[scripting|scripting]], [[#elements|operations]] and [[#result_script|failures]] belonging to the same command can be grouped using parent ''group'' element:+When using the %%XML%% logging together with [[scripting|scripting]], [[#elements|operations]] and [[#result_script|failures]] belonging to the same command can be grouped using parent ''group'' element:
<code xml> <code xml>
Line 391: Line 391:
===== Schema ===== ===== Schema =====
-XML schema for the XML log is available at:+An %%XML%% schema for the %%XML%% log is available at:
http://winscp.net/schema/session/1.0 http://winscp.net/schema/session/1.0
Line 439: Line 439:
===== [[parse]] Interpreting/Parsing ===== ===== [[parse]] Interpreting/Parsing =====
-To parse the XML log, use any XML parser available.+To parse the %%XML%% log, use any %%XML%% parser available.
-If possible, using [[library|WinSCP .NET assembly]] is the preferred approach, which hides away the XML log file from your application.+If possible, using [[library|WinSCP .NET assembly]] is the preferred approach, which hides away the %%XML%% log file from your application.
If you want to parse the XML log yourself anyway, see following guides to learn how to do that in different development environments: If you want to parse the XML log yourself anyway, see following guides to learn how to do that in different development environments:

Last modified: by martin