diff --git a/ATxCommon/Serializables/ServiceConfig.cs b/ATxCommon/Serializables/ServiceConfig.cs index 386ba4aff66d8385e71732f570aa110ed6854580..cdf684e4d68a9dc13d7a66329ae8f7fc4a3e2070 100644 --- a/ATxCommon/Serializables/ServiceConfig.cs +++ b/ATxCommon/Serializables/ServiceConfig.cs @@ -78,6 +78,11 @@ namespace ATxCommon.Serializables /// </summary> public bool Debug { get; set; } = false; + /// <summary> + /// The full path of a file to be used for RoboCopy log messages. Default: "" (off). + /// </summary> + public string RoboCopyLog { get; set; } = ""; + /// <summary> /// The interval (in ms) for checking for new files and system parameters. Default: 1000. /// </summary> diff --git a/ATxService/RoboCommand.cs b/ATxService/RoboCommand.cs index d3dc6ab09c9f19fa032d6709923708a4b46b63db..831f375c86048fb6633f6923c9b01fe5cf566327 100644 --- a/ATxService/RoboCommand.cs +++ b/ATxService/RoboCommand.cs @@ -80,7 +80,21 @@ namespace ATxService // retry options _roboCommand.RetryOptions.RetryCount = 0; _roboCommand.RetryOptions.RetryWaitTime = 0; + + // robocopy logging (NOTE: the "OutputToRoboSharpAndLog" option is required as + // otherwise messages will go to the log only and can't be processed by RoboSharp + // any more, resulting in no callbacks and therefore no progress reports etc.) + if (!string.IsNullOrWhiteSpace(_config.RoboCopyLog)) { + Log.Debug("Setting RoboCopy log file to [{0}]", _config.RoboCopyLog); + _roboCommand.LoggingOptions = new LoggingOptions { + LogPath = _config.RoboCopyLog, + OutputToRoboSharpAndLog = true, + VerboseOutput = true + }; + + } _roboCommand.Start(); + Log.Info("Transfer started, total size: {0}", Conv.BytesToString(_status.CurrentTransferSize)); Log.Trace("RoboCopy command options: {0}", _roboCommand.CommandOptions); diff --git a/Resources/conf/config.common.xml b/Resources/conf/config.common.xml index 81094939de77e47ea5cb7588a55ff6ba0f5638df..9532985bb5605e41720f1610e3fbd1a83ed9e04d 100644 --- a/Resources/conf/config.common.xml +++ b/Resources/conf/config.common.xml @@ -33,6 +33,9 @@ <!-- Debug: enable or disable debug log messages --> <Debug>true</Debug> + <!-- RoboCopyLog: a file to be used for RoboCopy log messages.--> + <RoboCopyLog>C:\Temp\autotx-robocopy.log</RoboCopyLog> + <!-- ServiceTimer: interval (in ms) for checking files and parameters --> <ServiceTimer>1000</ServiceTimer>