CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2011
    Posts
    3

    Question Is there any way to display '.log' file contents in a WebPage much quicker the below

    Hi,

    I am displaying the log file content in WebPage.If the log file size is say 2MB or more than that it takes more time(for 20MB it takes some 8-10 minutes) to display on WebPage. Please someone let me know how can i display log file content in WebPage much quicker(with less time).

    Whats the maximum size of '.log' file for displaying its content in the web page ?? Why it take soo much time if '.log file size is more ?? Is there any other way to achieve the above ??

    I am using the below code(C# code) for doing this , divLogSummary.InnerHtml = content.ToString(); where content is StringBuilder type, which will be having log file content. Please someone help me out to solve this issue.Thanks in advance.

    Regards,Chetan.

  2. #2
    Join Date
    Jun 2010
    Posts
    56

    Re: Is there any way to display '.log' file contents in a WebPage much quicker the be

    Where is the log file located?

    Are you loading the log into a local instance of IE, FF, Chrome?

    Is it possible the long processing time is the transfer of the file?

    Can you post the full code responsible for reading the log file? You can surround it with a code bracket to make it easier for us to read also.

  3. #3
    Join Date
    Jun 2011
    Posts
    3

    Re: Is there any way to display '.log' file contents in a WebPage much quicker the be

    The file is located in the server(not in the apllication directory).I am displaying log file in client IE/FF.

    Reading the log file takes less time than rendering(displaying) it.

    This is the code i am using for reading and displaying the logfile:

    LogFile.aspx

    <%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" EnableViewState="false"
    CodeBehind="LogFile.aspx.cs" Inherits="Sample.LogFile" %>

    <%@ MasterType VirtualPath="~/Site.Master" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" EnableViewState="false"
    runat="server">

    <div>

    <div id="divLogSummary" enableviewstate="false" runat="server">
    </div>
    </div>
    </asp:Content>

    LogFile.aspx.cs
    protected void LoadFile(string logFilePath)
    {
    try
    {
    StringBuilder content = new StringBuilder();
    if (string.IsNullOrEmpty(logFilePath))
    {
    return;
    }

    content.Append("<H2>");
    content.Append(" Log File</H2><BR><BR>");

    if (File.Exists(logFilePath))
    {
    using (FileStream fs = new FileStream(logFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
    {
    using (StreamReader sr = new StreamReader(fs))
    {
    content.Append("<P>");

    if (!sr.EndOfStream)

    {
    content.Append(sr.ReadToEnd());
    content.Replace("\r\n", "<BR>");
    }

    content.Append("</P>");

    }
    }

    }

    // Display the log file contents in the web page
    divLogSummary.InnerHtml = content.ToString();
    }
    catch (Exception exp)
    {
    // Handle exception
    }
    }

  4. #4
    Join Date
    Jun 2011
    Posts
    3

    Re: Is there any way to display '.log' file contents in a WebPage much quicker the be

    Please let me know what needs to be done.

    Thanks in advance.

    Regards,
    Chetan.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured