Skip to main content

Debugging & Logging

Applies to
Windows
MacOS
Linux

Find or configure application logs to find runtime issues.

All parts of Velopack have logging built in to help troubleshoot issues, and you should provide these logs when opening a GitHub issue about a potential bug.

Logging UpdateManager

You can provide your own instance of Velopack.Logging.IVelopackLogger to VelopackApp.SetLogger(IVelopackLogger). A logger can also be provided to the UpdateManager via its IVelopackLocator``Log property. The built-in locators support passing in an IVelopackLocator instance to their constructors. You cna also create a default locator using the Velopack.Locators.VelopackLocator.CreateDefaultForPlatform(ILogger) method. For example:


// ...

public class ConsoleVelopackLogger : IVelopackLogger
{
public void Log(VelopackLogLevel logLevel, string? message, Exception? exception)
{
var logMessage = $"[{DateTime.Now.ToShortTimeString()}] [{logLevel}] {message}";
if (exception != null) {
logMessage += Environment.NewLine + exception;
}

Console.WriteLine(logMessage);
}
}

// ...
using Velopack.Logging;

VelopackApp.Build()
.SetLogger(new ConsoleVelopackLogger())
.Run();

// ...
using Velopack.Locators;
using Velopack.Logging;

var locator = VelopackLocator.CreateDefaultForPlatform(new ConsoleVelopackLogger());
var updateManager = new UpdateManager("your-update-url", null, locator);

Logging in the Velopack binaries

Windows

Running Update.exe will log most output to it's base directory as Velopack.log. Setup.exe will not log to file by default. However, you can override the log location for both binaries with the --log {path} parameter. You can also use the --verbose flag to capture debug/trace output to log. Unfortunately, on Windows, to avoid showing up as a console window, these binaries are compiled as a WinExe and there will be no console output by default.
Please see the command line reference for a comprehensive list of arguments supported.

Linux

All logs will be sent to /tmp/velopack.log.

MacOS

Logs will be sent to /tmp/velopack.log or ~Library/Logs/velopack.log depending on your version of Velopack.

Advanced Debugging

The debug builds of Velopack binaries have additional logging/debugging capabilities, and will produce console output. In some instances, it may be useful to compile Velopack for your platform, and replace the release binaries of Setup.exe and Update.exe with debug versions.

If your issue is with package building, after building the rust binaries in Debug mode, it can also be useful to run the Velopack.Vpk project from Visual Studio with your intended command line arguments rather than running the vpk tool directly.

If doing this has not helped, you may need to debug and step through the rust binaries - for which I recommend the CodeLLDB VSCode extension.