0

I have a Visualforce page and a controller extension class. I know my VF page is invoking the extension class but why my system.debug('blah blah blah') in my controller extension class is not showing anywhere?

I created a New Trace Flag but still I don't see the system.debug message in my debug log or developer console log when I run the code.

New Trace Flag

Update When I open Dubug->Change Log Level.. -> I then got this error message I am not sure what it means

enter image description here

1

This is one confusing area of Debug Log: you always need to set it on a User because class/trigger debug flags don't actually generate logs.

Setting class and trigger trace flags doesn’t cause logs to be generated or saved. Class and trigger trace flags override other logging levels, including logging levels set by user trace flags, but they don’t cause logging to occur

See documentation

1

It is also important to note that the debug logs will only show up to 1.91MB of logs. If your debug statement is further down in processing, then it will not show up then either.

When I come across this issue, I usually have to adjust the logging levels to only show specific targeted results that I want to see and expand from there.

In the dev console: Debug -> Change Log Levels...

enter image description here

Then, I add a new log level here and mess with the values until I have come up with what I need. Usually move everything to INFO except for ApexCode.

enter image description here

Also, when the dev console is open, logs automatically get captured. You don't have to go into setup to start capturing debug logs for a time. As long as the user you are trying to debug has access to the dev console, you can log in as them in setup and capture those levels as well. If they don't, then you can add a debug log to them.

You can change the default log levels from the debug log setup screen as well via the Debug Level lookup.

2
  • thanks you for your answer. Which debug level setting will only show me the debug log message and debug log object message only? I have created a custom debug log object and i am using it to store and display try/catch exception and on top of that I am also using out of the box system.debug(). – CB4 Oct 2 '17 at 13:39
  • I'd start by changing everything to INFO except for ApexCode. Change that one to DEBUG. Then granularly add more stuff back in to see what gives you the information you are looking for. Then use your Developer Console to filter by debug statements by checking that checkbox when you open the debug logs. – JRiffe Oct 2 '17 at 13:47
0

Like a year ago a couple things changed and logging got harder for us, thats when we started using LoggingLevel.Error.

System.debug(LoggingLevel.ERROR, whatever);

might do the trick. You also might pay attention to the "Debug Level" in your screenshot, there you can change the level for different layers of the platform, like apex/database/visualforce etc.)

1
  • still not showing the debug.log message – CB4 Oct 4 '17 at 19:28

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.