reading wpi logs fixed
This commit is contained in:
parent
ce1842eef9
commit
b419cfc72d
2 changed files with 38 additions and 19 deletions
|
@ -740,12 +740,13 @@ namespace WebsitePanel.Server
|
|||
|
||||
Log.WriteError("WpiGetLogFileDirectory", ex);
|
||||
|
||||
throw;
|
||||
//throw;
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public SettingPair[] WpiGetLogsInDirectory(string Path)
|
||||
public SettingPair[] WpiGetLogsInDirectory(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -753,7 +754,7 @@ namespace WebsitePanel.Server
|
|||
|
||||
ArrayList result = new ArrayList();
|
||||
|
||||
string[] filePaths = Directory.GetFiles(Path);
|
||||
string[] filePaths = Directory.GetFiles(path);
|
||||
foreach (string filePath in filePaths)
|
||||
{
|
||||
using (StreamReader streamReader = new StreamReader(filePath))
|
||||
|
@ -773,7 +774,8 @@ namespace WebsitePanel.Server
|
|||
|
||||
Log.WriteError("WpiGetLogFileDirectory", ex);
|
||||
|
||||
throw;
|
||||
//throw;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -327,9 +327,12 @@ namespace WebsitePanel.Portal
|
|||
if (string.IsNullOrEmpty(wpiLogsDir))
|
||||
{
|
||||
wpiLogsDir = ES.Services.Servers.WpiGetLogFileDirectory(PanelRequest.ServerId);
|
||||
if (!string.IsNullOrEmpty(wpiLogsDir))
|
||||
{
|
||||
ViewState[_wpiLogsDirViewStateKey] = wpiLogsDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
//
|
||||
|
@ -532,15 +535,26 @@ namespace WebsitePanel.Portal
|
|||
protected void ShowLogsButton_OnClick(object sender, EventArgs e)
|
||||
{
|
||||
//show logs
|
||||
|
||||
string wpiLogsDir = null;
|
||||
object[] logsEntrys = null;
|
||||
try
|
||||
{
|
||||
string wpiLogsDir = ViewState[_wpiLogsDirViewStateKey] as string;
|
||||
wpiLogsDir = ViewState[_wpiLogsDirViewStateKey] as string;
|
||||
|
||||
if (!string.IsNullOrEmpty(wpiLogsDir))
|
||||
{
|
||||
//Get logs !!!
|
||||
object[] logsEntrys = ES.Services.Servers.WpiGetLogsInDirectory(PanelRequest.ServerId, wpiLogsDir);
|
||||
logsEntrys = ES.Services.Servers.WpiGetLogsInDirectory(PanelRequest.ServerId, wpiLogsDir);
|
||||
|
||||
if (null == logsEntrys)
|
||||
{
|
||||
WpiLogsPanel.Visible = true;
|
||||
string msg = string.Format("Could not get logs files. Log files folder:\n{0}", wpiLogsDir);
|
||||
WpiLogsPre.InnerText = msg;
|
||||
}
|
||||
else
|
||||
{
|
||||
WpiLogsPanel.Visible = true;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -549,7 +563,8 @@ namespace WebsitePanel.Portal
|
|||
{
|
||||
string fileName = (string) entry.Name;
|
||||
string fileContent = (string) entry.Value;
|
||||
sb.AppendLine().AppendFormat("<h3>{0}</h3>", fileName).AppendLine().Append(fileContent).AppendLine();
|
||||
sb.AppendLine().AppendFormat("<h3>{0}</h3>", fileName).AppendLine().Append(fileContent).
|
||||
AppendLine();
|
||||
}
|
||||
|
||||
WpiLogsPre.InnerHtml = sb.ToString();
|
||||
|
@ -557,12 +572,14 @@ namespace WebsitePanel.Portal
|
|||
ShowLogsButton.Visible = false;
|
||||
ProgressTimer.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WpiLogsPanel.Visible = true;
|
||||
WpiLogsPre.InnerText = ex.ToString();
|
||||
string msg = string.Format("wpiLogsDir: {0}\nlogsEntrys is null: {1}\n{2}", wpiLogsDir, logsEntrys == null, ex);
|
||||
WpiLogsPre.InnerText = msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue