You need to sign in to do that
Don't have an account?
sfdcdev.wordpress.com
Thanks,
Girish S
Apex File logging.
Hello,
It would be great if some one can suggest me a way to
develop Logger class that will log all my apex messages to a local file.
This would greatly help me, as this would give me an ability
to go through the failure messages, and debug the application more effectively.
I created an apex class that logs into Salesforce Document
object, but it would create 2 additional calls to Salesforce and is lot of
overhead for each request. Suggestions would be greatly appreciated.
Code:
public class Logger { private static final Document log = [Select d.Body From Document d where d.Name='LogFile'][0]; private String logMessage = ''; public void addToLog(String message){ logMessage = logMessage + System.now() + '::' +message + '\n'; } public void logmessage(){ log.body= Blob.valueOf(log.body.toString()+ logMessage); update log; logMessage = ''; } }
Thanks,
Girish S
dallas_sf
What do you mean by "local" file - all Apex execution happens on the platform?
werewolf
I guess you could log to a document like you seem to be trying to do, but that seems like a really bad idea. Why not just log to a Log custom object?