added boot folder to log and server info

This commit is contained in:
2022-01-03 23:57:40 +00:00
parent ce7d270e27
commit 5473d92dba
2 changed files with 17 additions and 13 deletions

2
.vscode/launch.json vendored
View File

@@ -48,7 +48,7 @@
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata", "AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
"AYANOVA_USE_URLS": "http://*:7575;", "AYANOVA_USE_URLS": "http://*:7575;",
//"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true", //"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true",
"AYANOVA_SERVER_TEST_MODE": "true", "AYANOVA_SERVER_TEST_MODE": "false",
//"AYANOVA_REPORT_RENDERING_TIMEOUT":"60", //"AYANOVA_REPORT_RENDERING_TIMEOUT":"60",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\" "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\"

View File

@@ -34,7 +34,7 @@ namespace AyaNova
var config = new ConfigurationBuilder().AddJsonFile("config.json", true).AddEnvironmentVariables().AddCommandLine(args).Build(); var config = new ConfigurationBuilder().AddJsonFile("config.json", true).AddEnvironmentVariables().AddCommandLine(args).Build();
//Set config or bail with error for missing items //Set config or bail with error for missing items
try try
{ {
ServerBootConfig.SetConfiguration(config); ServerBootConfig.SetConfiguration(config);
} }
@@ -44,9 +44,9 @@ namespace AyaNova
return; return;
} }
try try
{ {
@@ -201,6 +201,9 @@ namespace AyaNova
// NLog: setup the logger first to catch all errors // NLog: setup the logger first to catch all errors
var logger = NLogBuilder.ConfigureNLog(logConfig).GetLogger("BOOT"); var logger = NLogBuilder.ConfigureNLog(logConfig).GetLogger("BOOT");
#endregion
//This is the first log entry //This is the first log entry
logger.Info($"AYANOVA SERVER {AyaNovaVersion.VersionString} BOOTING"); logger.Info($"AYANOVA SERVER {AyaNovaVersion.VersionString} BOOTING");
@@ -217,7 +220,7 @@ namespace AyaNova
long UtilityFilesAvailableSpace = 0; long UtilityFilesAvailableSpace = 0;
try try
{ {
// Console.WriteLine($"##### program:about to call backupfilesdriveavailablespace, config is [{ServerBootConfig.AYANOVA_BACKUP_FILES_PATH}] ######"); // Console.WriteLine($"##### program:about to call backupfilesdriveavailablespace, config is [{ServerBootConfig.AYANOVA_BACKUP_FILES_PATH}] ######");
UtilityFilesAvailableSpace = new System.IO.DriveInfo(Path.GetPathRoot(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH)).AvailableFreeSpace; UtilityFilesAvailableSpace = new System.IO.DriveInfo(Path.GetPathRoot(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH)).AvailableFreeSpace;
} }
catch (Exception ex) catch (Exception ex)
@@ -236,6 +239,11 @@ namespace AyaNova
} }
//Get boot up folder for logging and later check for wwwroot
string startFolder = Directory.GetCurrentDirectory();
logger.Info("Boot path - {0}", startFolder);
logger.Info("OS - {0}", Environment.OSVersion.ToString()); logger.Info("OS - {0}", Environment.OSVersion.ToString());
logger.Info("TimeZone - {0}", TimeZoneInfo.Local.DisplayName); logger.Info("TimeZone - {0}", TimeZoneInfo.Local.DisplayName);
logger.Info("OS Locale - {0}", System.Globalization.CultureInfo.CurrentCulture.EnglishName); logger.Info("OS Locale - {0}", System.Globalization.CultureInfo.CurrentCulture.EnglishName);
@@ -247,8 +255,7 @@ namespace AyaNova
logger.Debug("Backup file space - {0}", FileUtil.GetBytesReadable(UtilityFilesAvailableSpace)); logger.Debug("Backup file space - {0}", FileUtil.GetBytesReadable(UtilityFilesAvailableSpace));
logger.Debug("Attachments file space - {0}", FileUtil.GetBytesReadable(AttachmentFilesAvailableSpace)); logger.Debug("Attachments file space - {0}", FileUtil.GetBytesReadable(AttachmentFilesAvailableSpace));
ServerBootConfig.BOOT_DIAGNOSTIC_INFO.Add("Boot path", startFolder);
ServerBootConfig.BOOT_DIAGNOSTIC_INFO.Add("OS", Environment.OSVersion.ToString()); ServerBootConfig.BOOT_DIAGNOSTIC_INFO.Add("OS", Environment.OSVersion.ToString());
ServerBootConfig.BOOT_DIAGNOSTIC_INFO.Add("Machine", Environment.MachineName); ServerBootConfig.BOOT_DIAGNOSTIC_INFO.Add("Machine", Environment.MachineName);
ServerBootConfig.BOOT_DIAGNOSTIC_INFO.Add("User", Environment.UserName); ServerBootConfig.BOOT_DIAGNOSTIC_INFO.Add("User", Environment.UserName);
@@ -264,18 +271,15 @@ namespace AyaNova
ServerBootConfig.BOOT_DIAGNOSTIC_INFO.Add("Attachments space", FileUtil.GetBytesReadable(AttachmentFilesAvailableSpace)); ServerBootConfig.BOOT_DIAGNOSTIC_INFO.Add("Attachments space", FileUtil.GetBytesReadable(AttachmentFilesAvailableSpace));
#endregion
//Ensure we are in the correct folder
string startFolder = Directory.GetCurrentDirectory();
var wwwRootFolder = Path.Combine(startFolder, "wwwroot");
//Test for web root path //Test for web root path
//If user starts AyaNova from folder that is not the contentRoot then //If user starts AyaNova from folder that is not the contentRoot then
//AyaNova won't be able to serve static files //AyaNova won't be able to serve static files
if (!Directory.Exists(wwwRootFolder)) if (!Directory.Exists(Path.Combine(startFolder, "wwwroot")))
{ {
var err = string.Format("E1010 - AyaNova was not started in the correct folder. AyaNova must be started from the folder that contains the \"wwwroot\" folder but was started instead from this folder: \"{0}\" which does not contain the wwwroot folder.", startFolder); var err = string.Format("E1010 - AyaNova was not started in the correct folder. AyaNova must be started from the folder that contains the \"wwwroot\" folder but was started instead from this folder: \"{0}\" which does not contain the wwwroot folder.", startFolder);
logger.Fatal(err); logger.Fatal(err);