function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sgkmillssgkmills 

Debug Output not displaying in Salesforce

I have the following trigger on a user object, but I am not getting any debugging information within the sandobx environment.  I have selected my 'Log Category' to be 'Apex Code' and 'Log Level' to be 'Debug'.

Nothing is being displayed?  Is there another setting or area where I must view the debug information for the trigger?

Code:
trigger NewUserTrigger on User(before insert, before update, after insert, after update) {

 Account temp_acc;
 String TestAcct = 'New User Trigger - do not delete or modify'; //Test Account
  System.Debug('Starting NewUserTrigger');

 try {
     System.Debug('SKM-NewUserTrigger');
  
  if (Trigger.isBefore) {     
     for (User u : Trigger.new) {
        System.Debug('Update--SKM-isBefore: ' + u.Full_Name__c );
     }
  } else if (Trigger.isAfter) {
        for (User u : Trigger.new) {
            System.Debug('Update--SKM-isAfter ' + u.Full_Name__c );
        }
  }
 }
 finally
 {
 }
}

 

Ron HessRon Hess
I've seen this if the trigger is marked as 'inactive" can you check this checkbox in the trigger detail page and see if it's set.

are you using the system log to view the debug information or Eclipse?
sgkmillssgkmills
Thanks, checking the isActive checkbox fixed it!!!

The isActive checkbox was not checked, but what would of caused it to be unchecked?  It was checked and I didn't uncheck it!  I mostly try to test via the sandbox, but write the code in Eclipse.
Ron HessRon Hess
it is possible that a save in eclipse could unset the active flag.

if this occurs once i would call it a fluke,
if it occurs each time you save the trigger from eclipse, please report this as a bug, include details about which rev of eclipse you are running.

thanks
TehNrdTehNrd
FYI, I just had the same thing happen to me. I created a brand new trigger in test and it was not set to active upon creation. Saving also doesn't set it to active.
TehNrdTehNrd
I've done some more testing and it appears all new triggers created in Eclipse default the trigger to inactive. This behavior is different from the original version of the toolkit where all new triggers were active upon creation.


Message Edited by TehNrd on 02-22-2008 10:34 PM
andresperezandresperez

I am having a similar problem... My debug statements do not get displayed, but the trigger is active.

I discovered the only way I get debug messages is when I get an exception... Let me show you what I mean.

This code does not display any messages (related to the trigger) in the log window:

trigger UpdateTPs on CoverLetter__c (after insert, after update, after delete, after undelete) {
    System.debug('In Trigger');
}

On the other hand, when I change the code to this:

trigger UpdateTPs on CoverLetter__c (after insert, after update, after delete, after undelete) {
    Integer a;
    
    System.debug('In Trigger');
    a = 1 / 0;
}

I get a whole bunch of messages in the log window:

10:12:57 DEBUG - 
***Begining Page Log for /apexpages/devmode/developerModeContainer.apexp
... Debug lines generated by page rendering code removed ...
*** Beginning APerezWom.UpdateTPs on CoverLetter trigger event AfterUpdate for a0F80000000xq2w

20090107151258.903:Trigger.APerezWom.UpdateTPs: line 4, column 5: In Trigger
System.MathException: Divide by 0

Trigger.APerezWom.UpdateTPs: line 5, column 9
Cumulative resource usage:
... Statistics removed ...

*** Ending APerezWom.UpdateTPs on CoverLetter trigger event AfterUpdate for a0F80000000xq2w

Element j_id30 called method {!save} returned type PageReference: none20090107151258.828:Class.APerezWom.My.reportWarning: line 17, column 9: 
... Debug lines generated by page rendering code removed ...


APerezWom.UpdateTPs: execution of AfterUpdate

caused by: System.MathException: Divide by 0

Trigger.APerezWom.UpdateTPs: line 5, column 9
***Ending Page Log for /apex/aperezwom__ViewCoverLetter—core.apexpages.devmode.url=1&id=a0F80000000xq2w 

 

Any ideas?
sgkmillssgkmills

When using Eclipse to do edits to my triggers, I have noticed that sometimes I don't get system.debug output in the system log window.  What I have done to fix it is refresh the classes from the server in Eclipse and then the system.debug messages start to display.

 

An example is I went into Salesforce and changed the API version of my class from 11.1, to 16.0 and then my system.debug messages stopped appearing.  I then when into Eclipse and refreshed the Class from the server and the system.debug messages started appearing.   Hopefully, this will help others who run into this situation.