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
JoyDJoyD 

Debugging cut short in Eclipse?

Has anyone else noticed this or know how to fix it?  All the sudden (in the past month or two maybe?) I noticed that when running my Test classes, the Debug Log is cut far short of the full log.  For instance:

11:16:57.316 (1316050000)|WF_RULE_FILTER|[Account : Category excludes Client] AND
 [Account : Category excludes MHK Fin. Client] AND
 [Account : Mortgage Rep not equal to null] AND
 [Account : Category includes MHK Real Estate] AND
 [Account : Category excludes Private Client Services] AND
 [Account : Account Recor

 Thats the last section of my debug log - it cuts off in the middle of not only the code, but the sentence and even the word!  I don't think I've changed anything...

 

Obviously this is kind of an issue since my code is breaking well AFTER this point - and I have no way to debug it!  Help!

Shashikant SharmaShashikant Sharma

Go to -> Addministration Setup -> Monitoring -> debug logs -> Click New -> Add the user that you have used in eclipse -> See the Filter details -> 

 

Update them like this

 

Category                                                       Level

 

Set Level to "Info" in all the catogary except Apex and System where you just set "Debug"

 

 

JoyDJoyD

I don't think you are talking about in Eclipse?  I think you are referring to running debug logs in the app - not in Eclipse?  Or have they changed the way things work and you have to set them up in the app to work in Eclipse?

Shashikant SharmaShashikant Sharma

In eclips also we mention credentials so I think these should be applied , you can try it , then either you can confirm me or correct me :)

Ankit AroraAnkit Arora

This looks strange, let me know which version of eclipse you are working with?

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

JoyDJoyD

I'm not exactly sure this is what you are asking, but here is my guess, hope this answers your question (I've only been doing this like 6 mo):

Eclipse IDE for Java Developers - Version: 1.2.2.20100216-1730 - Build id: 20100218-1602

Force.com IDE - Version: Winter '11 (20.0.1)

SteveBowerSteveBower

How are you running your tests when you get these results?

 

I'm guessing that you are trying to do a "Deploy To Server" and the Debug logs that you're getting back from the Production instance that you're trying to deploy to are being truncated.

 

If that's the case, let me know as I have a workaround for you.  There are no configuration settings or such that will address this.

 

Best, Steve.

 

JoyDJoyD

Nope, not trying to Deploy to Server, just a straightforward running of the tests as I build my test code at the bottom of the class.

In Eclipse, find the class in the list on the left sidebar, right-click -> Force.com -> Run Tests.

And then if I need to re-run after that, using the bottom bar Apex Test Runner and clicking Re-Run.

 

Haven't changed anything in how I do this, it used to work just fine (even with a lot longer test code).  I thought maybe they made a change with the recent release and cut the logs short after so many characters or something...?  But sounds like I'm the only one with this problem?

 

I found a workaround, to run the test from salesforce.com in the browser, it's a lot less easy to use, going back and forth between the two programs, running the same test twice, once in Eclipse so I can see the errors, and once in browser so I can see the debugging, but at least I finished my project yesterday.  Would love to get Eclipse working again... :-(

JoyDJoyD

okaaaay, so apparently my computer is just weird.  I just tried (AGAIN for the 50th time) and today it worked!

 

However!  I went to deploy, and am getting errors from the test code that don't come up in normal testing.  So back to you, , the logs ARE getting truncated there still.  Can you post the workaround you spoke about?

SteveBowerSteveBower

So, the workaround is super ugly but fairly simple to implement.  It hinges on the fact that while the debug log gets truncated, the values that are passed back to your test code aren't.

 

I accumulate a String with various debugging output, as well as regular output from the run.  In my case I was e-mailing various admins the results of the run as this was a batch job, so I just used the same string.

 

1.  in my code I changed all my system.debug()'s to a call to addMsg() which is:

public void addMsg(String s) {system.debug(s); emailMsg = emailMsg + '\n' + DateTime.now() + ' - ' + s;}

 

2. For the main function I was calling to kick off the test, I changed it from returning a void to returning a String.

 

3. At the end of the run, it returns the accumulated emailMsg as the String value.

 

4. In the testing code below, uncomment the system.assert() call.  The assertion will fail, and then you'll get the entire string value.  Just issuing a system.debug(xxx) wouldn't do the trick.

 

In my testing code:

 

		// Instantiate the class which runs the code.
		test.startTest();
		Client_Status_History_Review CSHR = new Client_Status_History_Review();
		//
		// Because the production system has so many validations and workflow rules set up on Client Status History records, we can't 
		// see the entire debug log if something goes wrong in order to see our error messages.  So, the only way we can get them is
		// to return them to the calling test function.  And, even then they won't show up in the debug log unless we can force it somehow.
		// One way to force it is to have an assertion fail with the text of the Debug log in the assertion.
		String xxx = CSHR.doReview();
		// The following fails and gives us our Debug log.
		// In real testing we don't want this line as we would never go on to the testing assertions below.
		//system.assertEquals('',xxx);
		test.stopTest();

 

So, this was kludgy, but it was the only way I could find to get my full debug output.  I'd love to hear other solutions if people any any.   Best, Steve.

 

 

 

 

 

 

giorgio70giorgio70

SteveBower's idea is brilliant! It's klunky, I agree, but it does the trick!