1

I've got my Apex Code debug log level set to FINE (was DEBUG) and System debug log level set to FINE (was DEBUG). I'm still not seeing the result of my system.debug statements in the log file. I've also changed logging level on the system.debug statement to LoggingLevel.ERROR.

The code in question is initiated by a button press in a Visualforce page. Also, the log file has not been truncated.

What have I missed? Debugging apex when I can't get to my system.debug output is just about impossible.

Visualforce button code that calls the Apex method:

<apex:pageBlockSectionItem >
<apex:commandButton action="{!removeSelectedNow}" value="Remove Selected Now" rerender="tablepanel,tableblock,table,panelMsg" id="theRemoveBtn"/><p/>
</apex:pageBlockSectionItem>  

Apex code:

public PageReference removeSelectedNow() {
system.debug(LoggingLevel.ERROR,'xyzzy-removeSelectedNow() - start');
...
  • do you see a Log file at all? or just not your debug statements in the log file? – cropredy Jan 5 '16 at 17:45
  • Yes, there is a log file. I don't see my debug statements. The log file has not been truncated. – Jagular Jan 5 '16 at 17:52
  • Is the button press's action being blocked by a javascript error (see JS console in favorite JS debugger)? – cropredy Jan 5 '16 at 18:07
  • No, I'm pretty sure I'm getting to the Apex code. I get some run time conversion errors that do get logged. Without the system.debug, homing in on exactly which line(s) cause the problem is hard. – Jagular Jan 5 '16 at 18:18
  • 1
    when the commandButton is clicked, VF will send all form values to their respective setters. If any of these blow up, the removeSelectedNow() will not be reached – cropredy Jan 5 '16 at 19:31
2

When using a apex:commandButton with an action= attribute, SFDC will first decode the view state, then use the values from the form (or enclosing actionRegion) by calling the respective setters in the controller and then invoke the action method.

If the setters blow up with an uncaught exception, the action method will never get invoked and your debug statement will never appear.

This is all documented in the VF Order of Execution (excerpted below - you may be failing at step 2)

enter image description here

| improve this answer | |
0

If your code is in a managed package, the logs won't show in the Debug Logs page. You can only see logs from managed package via the LMA.

| improve this answer | |
  • It's not a managed package, but that's a useful detail to know. What is LMA? – Jagular Jan 5 '16 at 18:05
  • 1
    License Management App. It's an official app from Salesforce that allows you to track who has installed your managed package (and also allows you to view the logs from your package in your customer's orgs, provided they give you access). The only information I managed to find is from 2010: resources.docs.salesforce.com/168/latest/en-us/sfdc/pdf/lma.pdf – mkorman Jan 5 '16 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.