4

When the developer console is opened Salesforce will start capturing ApexLog records for the current user. After a period of time this stops occurring and the user needs to click the resume menu method so the logs start updating again.

Alternatively, you can start a similar capture process from

Setup > Administration Setup > Monitoring > Debug Logs > Monitored Users - New

If neither of these options are active no ApexLog entry gets created.

How can I start the capturing of ApexLog records using just the API?

I'd imagine the tooling API would be the place to start, but the Metadata or partner APIs would also be fine.

6

Found it it in the Tooling API -

TraceFlag
Represents a trace flag that triggers an Apex debug log at the specified logging level.


• To set up a log for a specific user, set ScopeId to null and TracedEntityId to the ID of the user. This option can only be configured for a user, not an Apex class or Apex trigger.
• To configure logging levels for system logs (visible only to you), set ScopeId to user and TracedEntityId to the ID of the logged-in user.
• To set up a system log (visible only to you) for a specific Apex class or trigger, set ScopeId to user and TracedEntityId to the ID of the Apex class or trigger.

There is a good explanation in the answer to Debugging logs in Developer Console is not working

  • Curiously, the Summer '15 Release Notes say "Setting trace flags doesn’t cause logs to be generated or saved. Trace flags override other logging levels, but they don’t cause logging to occur. If logging is enabled when classes or triggers execute, logs are generated at the time of execution." But creating a TraceFlag by setting TracedEntityId to a user id does enable logging. – xn. Jul 21 '15 at 20:36

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.