From 797c57121a409af19bbcaf5261e8211810748184 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Thu, 23 Feb 2023 05:40:12 +1300 Subject: [PATCH] vncserver: add debug output on config load --- unix/KasmVNC/Config.pm | 3 +++ unix/vncserver | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/unix/KasmVNC/Config.pm b/unix/KasmVNC/Config.pm index 7bcfdc2..2b199e4 100644 --- a/unix/KasmVNC/Config.pm +++ b/unix/KasmVNC/Config.pm @@ -8,6 +8,8 @@ use Data::Dumper; use Hash::Merge::Simple; use KasmVNC::Utils; +our $logger; + sub merge { my @configsToMerge = map { $_->{data} } @_; my $mergedConfig = Hash::Merge::Simple::merge(@configsToMerge) // {}; @@ -31,6 +33,7 @@ sub load { failIfConfigNotReadable($self->{filename}); + $logger->debug("Loading config " . $self->{filename}); $self->{data} = YAML::Tiny->read($self->{filename})->[0]; } diff --git a/unix/vncserver b/unix/vncserver index cae50ac..e2d84bc 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -1171,6 +1171,7 @@ sub DefineFilePathsAndStuff { $KasmVNC::Users::vncPasswdBin = $exedir . "kasmvncpasswd"; $KasmVNC::Users::logger = $logger; + $KasmVNC::Config::logger = $logger; $vncSystemConfigDir = "/etc/kasmvnc"; if ($ENV{KASMVNC_DEVELOPMENT}) { @@ -1979,7 +1980,7 @@ sub DefineConfigToCLIConversion { $self = shift; my @values = @{ listify($self->configValues()) }; - + my $valuesStr = ""; foreach $value (@values) { $valuesStr = $valuesStr . "-http-header '$value' " @@ -2754,5 +2755,6 @@ sub SetAppSettingsFromConfigAndCli { } sub InitLogger { - $logger = KasmVNC::Logger->new(); + my $debugEnabled = any { $_ eq "-debug" } @ARGV; + $logger = KasmVNC::Logger->new({ level => $debugEnabled ? "debug" : "warn" }); }