I have created a class that is related to a form the code does not log

public class QuoteMachinesCartController {
public String opportunityId{set; get;}
public String name{set; get;}
public String paste{set; get;}

public Opportunity getOpportunity() {
    if(opportunityId == null) {
        opportunityId = ApexPages.currentPage().getParameters().get('OpportunityId');
    return [select Id, Name, AccountId from Opportunity where Id=:opportunityId];

public Account getAccount() {
    System.debug('Find account');
    String id = getOpportunity().AccountId;
    return [select Id, Language__c from Account where Id = :id];

//Database.Query(strSoql);  Use this for creating string queries for SOQL
public PageReference save() {
    System.debug('Saving data in QuoteMachinesCartController');
    Pricebook2 pb = [select Id from Pricebook2 where isStandard=true limit 1];

    Quote q = new Quote(Name=name, OpportunityId=opportunityId, Pricebook2Id=pb.Id);
    insert q;

    String pid = '';
    // items
    List<String> items = paste.split(':::::');

    // Product2Id, Descripcion, Quantity, Price
    for(String item : items ) {
        List<String> params = item.split(':::');
        pid = params[0];
        PricebookEntry pbook = [SELECT Id FROM PricebookEntry WHERE Product2Id = :pid];
        QuoteLineItem qi = new QuoteLineItem(
            QuoteId = q.Id,
            PricebookEntryId= pbook.Id,
            Description = params[1],
            Quantity = Decimal.valueOf(params[2]),
            UnitPrice = Decimal.valueOf(params[3])

        insert qi;

    PageReference page = new ApexPages.StandardController(q).view();
    return page;

As you can see I have System.debug in my methods but when I go to Setup > Monitor > Debug Logs I don't see anything, I'm working on a sandbox.

  • In addition to the current answers, if you are seeing logs get created, but they don't have your entries, try increasing the LoggingLevel. E.g. System.debug(LoggingLevel.Error, 'Hello'); Sep 25 '13 at 2:42
  • Did you enable logging for the user?
    – Mike Chale
    Sep 25 '13 at 12:18

Can you check the 'Log Filters' to see if you have overridden and set the level to 'None' or anything above 'Debug'? You can check that under 'App Setup->Develop->Apex Classes->your class name. Here is the screenshot that shows it.enter image description here


Have you tried checking in the developer console? Logs there seem to be more reliable these days, though you might have to click "Resume Updating" in the debug menu if nothing is appearing as you click through your page etc.

You can also set the filters in there and you'll want to make sure the Apex option is set to DEBUG at least. You can configure those from the Debug Menu also:

enter image description here


Just in case you havent found the solution for your problem. I run into something similar, there were actually 2-3 things that i need to do to find out what was going on:

  1. I didnt have log request available, when I add my user to monitor, it gives me 20 logs, i guess (please some one confirm me) each time that a system debug is print it reduce this log to 1, please see image below enter image description here

  2. The second issue that I had was that for some reason my controller method was not been executed, so on my visual force page I add:

<apex:pageMessages /> inside the < apex : form ....

this help me to find out the error on the page, it ended up been a required field that I wasn't filling.

  1. I will also recommend to use firebug, as I was also using angularjs, and I was having an error when certain conditions where applied, this was affecting the way the page was loading.

I hope this helps


I've had success using this debug call instead to set it to 'info' level which comes through when debug-level does not:

System.debug(LoggingLevel.Info, 'your logging message here');

I had a situation where the debug logging level in the Developer Console was so fine that early debug statements simply weren't displayed. Changing logging level from "Finest" to "Debug" solved it.

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.