2

If I add the Debug statements inside the constructor it is not displaying in the log.

Please suggest why this is happening.

  • Silly question, but are you sure that the constructor with the logging is actually being called? Maybe there is another constructor that takes a different set of parameters? – Daniel Ballinger Jun 26 '14 at 1:46
2

I do not think it is the fact that it is the constructor that is the problem, it is because Salesforce has a strange way of logging sometimes (if the log gets too long, Salesforce will stop printing some logs). Have a look at my question here:

For me, if I want something to log without fail for testing reasons, I will raise a custom exception. It is not pretty, but it saves me messing around with filtering logs and setting logging levels.

| improve this answer | |
  • 1
    Also, turn all logs to None or Error, and log all debugs at the error level using System.debug(LoggingLevel.ERROR, Object). – sfdcfox Jun 25 '14 at 5:50
0

From what I can tell Salesforce selectively removes lines from the debug log to conserve space. You can look for this by searching for something like this in the logs. In other cases there may be a statement towards the bottom that the max debug log size was reached.

*** Skipped 3392766 bytes of detailed log

You can log a case with salesforce to see if they'll increase the size limit on debug log temporarily, are adjusting your logging levels so that the overall debug log size is reduced and salesforce doesn't do it's log trimming. To ensure you have the best chance of seeing your debug logs, set the log levels to DEBUG for APEX, and to ERROR for all other categories.

| improve this answer | |

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.