Skip to content
Snippets Groups Projects
Commit ca1c4d00 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Add option to request RoboCopy logging to a file.

parent f5ad2943
No related branches found
No related tags found
No related merge requests found
......@@ -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>
......
......@@ -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);
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment