If I add the Debug statements inside the constructor it is not displaying in the log.
Please suggest why this is happening.
If I add the Debug statements inside the constructor it is not displaying in the log.
Please suggest why this is happening.
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.
System.debug(LoggingLevel.ERROR, Object)
.
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.