+ Start a Discussion
JBabuJBabu 

To set the log levels (when Max debug log size is reached)

Hi,

 

I am running unit tests and I need to see values at few places.

 

So I have used debug statements similar to below one at lot of places:

 

  system.debug(Logginglevel.ERROR,'message no # 1');

 

Still I am not able to see the messages in debug log b/c of max debug log size issue.

 

I also went to developer console - > workspace: Default -> Change log levels -> I have changed every one to ERROR level.

 

Once I ran the test class and see log file on the first line of the file I see below details

 

"24.0 APEX_CODE,FINE;APEX_PROFILING,FINE;DB,INFO;VALIDATION,INFO;WORKFLOW,FINEST"

 

I am not sure why the levels are not changed in the above debug log.Please help me on this.

 

Thanks,

JBabu.

stunaitestunaite

Have you tried to use the "Developer Console"?

 

You can open it going to:

 

user menu -> developer console

 

Hope that helps

 

Joao

 

PS: Please mark as solution if it fixed your problem

 

JBabuJBabu

Hi,

 

I have changed the log settings in developer console (Workspace Default-> Change log settings, made every one to ERROR).

But I cannot execute the test class in developer console as it has static variables.

 

I have placed statements like :

 

system.debug(Logginglevel.ERROR,'message no # 1');

 

in my apex test class. But filtering of the log file is not happening.

 

Please let me know where am I doing wrong.

 

Thanks,

JBabu.

 

stunaitestunaite

Have you tried to use the debug logs:

 

setup -> monitoring ->debug logs (then choose your user)

 

 

JBabuJBabu

Yes, I am seeing debug log files from set up-> monitoring-> debug logs.

 

But first line of debug log file show below details even after changing the log level settings in developer console.

 

"24.0 APEX_CODE,FINE;APEX_PROFILING,FINE;DB,INFO;VALIDATION,INFO;WORKFLOW,FINEST"


Jerun JoseJerun Jose
testmethods run with their own set of log levels which cannot be changed.

I know its frustrating.
Vote on my idea below
https://sites.secure.force.com/success/ideaView?id=08730000000iKMpAAM

The way I labour through it is to do unit record test cases to see the logs and then once I am confident of each test case, put them all in bulk
mhighmarkmhighmark

We just hit the wall on this issue. We resolved it with a combination of:

 

  1. Setting log levels in Developer Console(Workspace=>Change Log Levels) to lowest possible (ERROR) on all options.
  2. Whenever calling our system.debug, we use: System.debug(LoggingLevel.ERROR, ''our message'' );


We got from a log file of 1.9MB to 1Kb!!!

textualtextual

kinda funny you cant set log levels in test mode, since thats exactly when you need the control the most. Since the existing test class was so large, i ended up removing testmethod from all the tests and then created a single testmethod class that calls them all. that way, if my log levels get too large, i can isolate which test is throwing the error and then address it.