8

I spend my days waiting on the Force.com Console and it makes me crazy, I have a pretty nice machine and it still chokes on the details sometimes.

Anyways, I saw Loggly had given a presentation at DF '11 and is presenting again this year Dreamforce '12.

However, it seems like they're presentation is targeted at using their product, or for that matter others like it (SumoLogic, Splunk) on Heroku, and not really targeting APEX/VisualForce development!

Is this the case? Are there any better solutions out there for reviewing logs?

Are there any APIs that allow you to export your debug logs out of SFDC programatically? Or has anyone even tried to tackle this?

  • Can you please let me know how are you getting the contents of the debug log page ? I have been using this : https://{server}/secur/Frontdoor.jsp/?sid={sessionId}/{apexlogurl} when I try to read the page contents I get a "Javascript not enabled" message in the read content! Can you please explain me what is wrong here ? – user2716 Apr 20 '13 at 10:55
  • IlluminatedCloud and IntelliJ Idea with the integrated Offline debugger is great for reviewing logs and stepping through code and the log in context to debug – Eric Aug 30 '17 at 3:50
17

I've been working on a tool that allows you to export the apex logs and then gives you some basic highlighting, searching and filtering options. I often end up working with logs closer to 2 MB in size and needed a way to quickly filter out just the USER_DEBUG messages.

FuseIT SFDC Explorer is .NET based and currently only runs on Windows. It is still in beta (the kind of beta where there are still sharp edges that you could cut yourself on. I.e. don't be surprised if it crashes occasionally).

The screen shots on the web site are a bit out of date. What I often do is bring the Force.com console up to ensure that it is polling and capturing the logs. Then I can use the Refresh and Open Log buttons on the Apex Logs tab to open up the required log.

FuseIT SFDC Explorer

Once you have a log open you can use the checkboxes in the left Apex Log area to show/hide only certain events. Alternatively, you can right click on an event in the log to hide it from there.

FuseIT SFDC Explorer Toggle Raw/Grid Log

If you just want a quick way to download the raw log then you can toggle the view to just show the log text. There is a copy log to clipboard button if you just want to grab the whole thing to paste into the editor of your choice. The paste allows you to drop in partial logs or logs copied out of Force.com explorer.

  • awesome!!! how do you get the logs out of Force.com? Do you capture the responses to the browser? – jordan.baucke Aug 9 '12 at 21:31
  • 1
    @jordan.baucke I use the SOAP API to query the ApexLog to get the Ids. Then I create a call to to the Salesforce front end website to download the log content by setting the request headers with the session Id. – Daniel Ballinger Aug 9 '12 at 21:49
  • clever that's def. awesome! – jordan.baucke Aug 9 '12 at 22:15
  • Is there any way to pull in all user logs not just the logged in one? – Daniel Sokolowski Feb 27 '14 at 6:06
  • @DanielSokolowski Sure, just adjust the filtering on the LogUserId column. Or are you referring to the FuseIt SFDC explorer explicitly? – Daniel Ballinger Feb 27 '14 at 18:38
5

Agreed that the ExtJS console needs a lot of work. anything halfway complex will bring the interface to its knees. I have settled into a groove of running unit tests from the website and downloading the log, or copying and pasting the raw log into Notepad++, once there its a 2 click operation to find the lines with this regular expression "USER_DEBUG|FATAL|MAXIMUM DEBUG|Op:|SOQL_EXECUTE_BEGIN|SOQL_EXECUTE_END" and then press "Find All in Current Document"

That brings up a list of matching lines below that you can double click on to navigate through the log without making your eyes bleed.

Search "USER_DEBUG|FATAL|MAXIMUM DEBUG|Op:|SOQL_EXECUTE_BEGIN|SOQL_EXECUTE_END" (505 hits in 1 files)
C:\Downloads\apex (33).log (505 hits)
Line 208: 00:06:53.652 (6652739000)|USER_DEBUG|[13]|DEBUG|org: 00DM0000000Br5EMAS
Line 261: 00:06:53.698 (6698356000)|USER_DEBUG|[67]|DEBUG|setting ProjectID = 21060077
2

What browser are you using?

I gave up using anything other than Chrome with the Developer Console. It's the only browser that I got any sort of decent response.

It still can be a bit glitchy now and then, but it's hands down better than IE or FF performance.

As for exporting your debug logs - There's no Download option anymore (sigh)... I did find that if you select the desired log and then click the "Open Raw Log" button you get a version that will copy and paste nicely into Notepad++

I often do this for the big logs simply because it's more responsive to my filter and search requests.

  • yeah I'm using Chrome, I found it more responsive actually than FF (on Windows) ... just recently switched to OSX so maybe I need to play with it. – jordan.baucke Aug 9 '12 at 20:00
  • Chrome is the fastest browser to use with the Developer Console but occasionally has issues with scrolling. Firefox generally doesn't have the scrolling issue or issues with expanding trees (such as when exmaning a heap dump) but occasionally it fails to load large heap dumps. Unfortunately IE9 appears to be the most functional with the developer console, but Chrome is the fastest if you avoid functionality that causes issues. – E.J. Wilburn Aug 9 '12 at 20:43
  • The biggest frustration for me are the debug log size limits. With anything moderately complicated your log gets truncated if Apex Code logging is set to Debug or finer, especially when testing large record batches (200 records at a time). – E.J. Wilburn Aug 9 '12 at 20:44
  • @Wilburn, cut down on the log levels. I usually override the default settings per apex file to set DEBUG on apex and NONE on everything else. – ebt Aug 9 '12 at 20:58
  • OR put log levels on APEX to INFO and add system.debug(LoggingLevels.INFO,'I made it'); to cut down on a majority of the log spam. – ebt Aug 9 '12 at 21:05
1

I'm going to post this to one other question. But here's a quick script that downloads all logs to a "log" subdirectory.

#!/bin/bash

# script for export ALL debug logs to a subdirectory
# named "log".  
#
# it requires the "force" CLI tool be available and
# assumes the user is already logged in.
#
# Sure, I could have added more debugging, like checking
# to see if the user was logged in, but I didn't have 
# all night. ;-)
#
# 2017-08-29 tggagne@gmail.com

for each in $(force query "select id from apexlog"); do
    log=$(echo $each | sed -e 's/"//g')

    if [ "$log" == "Id" ]; then
        echo "ignoring $log"
        continue
    fi

    echo "writing log/$log.debug"
    force log $log > log/$log.debug
done
0

I use Sublime Text 2 with a customized plugin.

https://github.com/mdenavacelle/SublimeApexLogReader

Grabs all debug logs with a keyboard shortcut.

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.