Have you guys ever considered the possibility of adding file logs rotation to the DuetControlServer and the DuetWebServer ?
For the DuetControlServer is pretty straight forward adding another rule in the config with a FileTarget
using NLog;
using NLog.Config;
using NLog.Targets;
var config = new LoggingConfiguration();
// Define file target with log rotation
var fileTarget = new FileTarget("logfile")
{
FileName = "/opt/dsf/sd/sys/log-${shortdate}.log",
ArchiveFileName = ""/opt/dsf/sd/sys/archive/log-{#}.log", // Archived files pattern
ArchiveNumbering = ArchiveNumberingMode.Rolling,
ArchiveAboveSize = 10 * 1024 * 1024, // 10 MB size limit
MaxArchiveFiles = 5, // Keep max 5 archive files
ConcurrentWrites = true,
KeepFileOpen = false,
Encoding = System.Text.Encoding.UTF8,
Layout = "${longdate} [thread-${threadname:whenEmpty=${threadid}}] ${uppercase:${level}} - ${message}"
};
// Add the target to configuration
config.AddTarget(fileTarget);
// Define a rule to log everything from Debug level and higher
var rule = new LoggingRule("*", LogLevel.Debug, fileTarget);
config.LoggingRules.Add(rule);
// Apply configuration
LogManager.Configuration = config;
Notice how, in the code snippet above, the pattern layout that includes the current thread that is running, it might be very handy since DCS is a multi-threaded program.
For the DuetWebServer it could get very complex since Microsoft default logger for ASP.NET does not have file logs rotation options; there are some workaround using Serilog but maybe it would be easier to just use NLog as well, or Log4net even better