Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my debug msg not being written into my page?

I've got some debug msgs (written via Response.Write()) that I can see when I do a "View Source" like so (within VB code):

currentYear = Year(Now)
SQLString = "Select NewBiz from MasterUnitsprojSales where CYear = " & currentYear & " and Unit = '" & Unit & "'"
adoRS = New ADODB.Recordset
adoRS.Open(SQLString, adoCon)
IsNewBusiness = TRUE 'default (if record not found)
Category = "New Business"
If Not adoRS.EOF Then
    IsNewBusiness = adoRS.Fields.Item(0).Value <> 0 
    if Not IsNewBusiness
            Category = "Existing Business"
    End If
    Response.Write("<!-- IsNewBusiness after NOT EOF assignment = " & CStr(IsNewBusiness) & "-->")
End If
adoRS.Close()

-and (within hmtl):

<% Response.Write("<!-- Is New Biz = " & IsNewBusiness & "-->") %>

I can see these messages when I go to the page and "View Source"

But I have other similar instances that are not being written out, such as:

If Request.Form.Item("Action") = "Save" Then
    Response.Write("<!-- Made it into the Action =Save block -->")
    . . .

I know this block is bring reached, because the logic in it is taking place (database inserts).

Why would the Response.Write() not always work?

like image 908
B. Clay Shannon-B. Crow Raven Avatar asked Mar 07 '17 00:03

B. Clay Shannon-B. Crow Raven


People also ask

Why can't I See my debug messages on the custom site?

It's likely that you need to add trace filters specific to the Site Guest user if you want to see your debug messages when you access your page via the custom Site.

Why is the debug file not showing up on my Desktop?

Your system may show the Debug file on its desktop if the debug file is located in the startup folder (due to which file will be recreated on every system restart). In this scenario, removing the file from the startup folder may solve the problem.

How to create Debug log for a specific user name?

Please check that in your visualforce page you have added the controller to the page. In debug log , please delete all the List under ‘User Trace Flag’. After creating the log , set the date and time for that particular user name.

What is a debug file and how to fix it?

The creation of a Debug file is a reported bug on Chromium-based browsers, especially when the browser is used to download/open PDF files. In this context, opening the PDF files with a browser that is not Chromium-based (like Firefox or Safari) or another application may solve the problem.


2 Answers

Is your HTML comment line being appended to other text in the Response?

If so, it might be rendered far to the right (out of sight) in your "View Source" display.

Try to insert carriage return - line feed characters before and after this text.

Response.Write(vbCrLf + "<!-- Made it into the Action =Save block -->" + vbCrLf)

If this is the problem, doing a Ctrl-F find in the "View Source" display may reveal this comment line.

like image 145
JohnH Avatar answered Oct 02 '22 16:10

JohnH


Is your page reloading or redirecting after the Save? That would explain it.

like image 25
Chalky Avatar answered Oct 02 '22 16:10

Chalky