« Previous Next »

Thread: Template file output not written when 0 elements output

Last post 02-15-2008 7:15 AM by jose_gisbert. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 01-31-2008, 6:32 PM

    Template file output not written when 0 elements output

    Hello,

    I am analyzing IIS server errors (Ch02ServerErrors.SQL from the Log Parser Toolkit) and found that when there are 0 elements output, the template file that I send the output to does not get written.

    Is there a switch or something that will force the template to be written even though there are 0 records to be passed to the <LPBODY> part of the template? It makes more sense to me to have the table headers printed with no records below them (indicating no errors) than to not process and output the template which is happening now.

    During testing, I also see that the HTML output file that is pointed to by the SQL statement (Select ... INTO ServerError.html From ....) is deleted. In this example, the ServerError.html file is deleted and then not replaced with current output resulting in a broken link in my web stats application.

    Thanks,
    Jim

  • 02-01-2008, 5:22 PM In reply to

    Re: Template file output not written when 0 elements output

    A quick update that when reading the Web Parser Toolkit a bit closer, I did find the noEmptyFile switch described in Appendix D. However, even adding "-noEmptyFile:ON" on my command line does not impact the fact that any existing file is deleted and nothing replaces it when 0 records are to be output. From what I can tell, this switch does not do as it is described (or maybe I'm not using it correctly... always a distinct possibility 8b).

    Any suggestions would be greatly appreciated.

    Thanks,
    Jim
     

     

     

  • 02-04-2008, 2:04 AM In reply to

    Re: Template file output not written when 0 elements output

    Hi Jim,

    Have you tried fileMode switch? you can choose to overwrite the output with it.

    Zhao Ji Ma
    Sincerely,
    Microsoft Online Community Support

    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
  • 02-08-2008, 4:20 AM In reply to

    Re: Template file output not written when 0 elements output

    Sadly, the fileMode switch doesn't make a difference. Even when I specifically set it to -fileMode:1 which it should be by default (append=0, overwrite=1, do not overwrite=2), the same thing happens.

    This really looks like a bug in that when there are 0 records for output, no template output is ever written. For instance, even if I split the template up into the three separate files for tplHeader, tpl and tplFooter (e.g. <LPHEADER>, <LPBODY> and <LPFOOTER>), I would expect that the header and footer sections still print because they contain important info such as fieldnames, timestamp, etc. However, since Log Parser first deletes the existing output file and then does not process (or at least output) the tplHeader/tplFooter files, no output is generated at all and I'm left with a missing file from my web site. 

    For testing, I am checking for IIS status code 500 errors in my log file. If none are found, the output file from the previous run gets deleted and not replaced. If I change my query to find at least one 5xx status code (different log file or date range), then the output file is created just fine.

    With that said, is there any hope of a Log Parser 2.3 anytime in the near future?

    -Jim

  • 02-08-2008, 5:52 AM In reply to

    Re: Template file output not written when 0 elements output

    Never mind... I just realized that I had -noEmptyFile:ON when I should have been using -noEmptyFile:OFF. As Dogbert says in the comic taped to my monitor, "OUT OUT!! YOU DEMONS OF STUPIDITY!!"

    Duh,
    Jim
     

  • 02-15-2008, 7:15 AM In reply to

    • jose_gisbert
    • Not Ranked
    • Joined on 02-15-2008, 6:15 AM
    • Santiago del Estero
    • Posts 3

    Re: Template file output not written when 0 elements output

     i solve this problem with something like this in  .bat file:

    Rem *** Example 

    logparser  "select * into xxx.html from ... "  -i:.. -otpl  -tpl:...

    if not exist xxx.html copy xxx2.html xxx.html

    rem  ***  End example

    where xxx2.html is an static html page with the legend "No Data Found" 

    Enjoy! 

     

     

     

    ------------------
    José Gisbert
    SDE-Argentina
Page 1 of 1 (6 items)
Microsoft Communities