diff --git a/src/Core/ContainerResourceBuilder.cs b/src/Core/ContainerResourceBuilder.cs
index c1a3a59..0dcf26d 100644
--- a/src/Core/ContainerResourceBuilder.cs
+++ b/src/Core/ContainerResourceBuilder.cs
@@ -414,6 +414,12 @@ public ContainerResourceBuilder WithLogLevel(SourceLevels level)
///
public virtual ContainerResourceSettings Build()
{
+ var logLevel = Environment.GetEnvironmentVariable("SQUADRON_LOG_LEVEL");
+ if (Enum.TryParse(logLevel, true, out SourceLevels overriddenLogLevel))
+ {
+ _logLevel = overriddenLogLevel;
+ }
+
_options.DockerConfigResolver ??= ContainerResourceOptions.DefaultDockerConfigResolver;
_options.Logger = new Logger(_logLevel, _options);
_options.Cmd = _cmd;
diff --git a/src/Core/DockerContainerManager.cs b/src/Core/DockerContainerManager.cs
index c07003d..8774675 100644
--- a/src/Core/DockerContainerManager.cs
+++ b/src/Core/DockerContainerManager.cs
@@ -729,9 +729,18 @@ private Task Retry(Func execute)
private async Task RetryAction(Exception exception, TimeSpan t, int retryCount, Context c)
{
_settings.Logger.Warning($"Docker command failed {retryCount}. {exception.Message}");
+
SystemInfoResponse? systemInfo = await Client.System.GetSystemInfoAsync();
- _settings.Logger.Warning($"Driver status: {string.Join(", ", systemInfo.DriverStatus)}");
- _settings.Logger.Warning($"System status: {string.Join(", ", systemInfo.SystemStatus)}");
+
+ if (systemInfo is { DriverStatus: { Count: > 0 } })
+ {
+ _settings.Logger.Warning($"Driver status: {string.Join(", ", systemInfo.DriverStatus)}");
+ }
+
+ if (systemInfo is { SystemStatus: { Count: > 0 } })
+ {
+ _settings.Logger.Warning($"System status: {string.Join(", ", systemInfo.SystemStatus)}");
+ }
}
public void Dispose()