Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » How to make the Logger snippet work(The Logger snippet in the documentation doesn't seem to work. How to fix it?)
How to make the Logger snippet work [message #1785371] Fri, 13 April 2018 06:54 Go to next message
Janos Gyerik is currently offline Janos GyerikFriend
Messages: 1
Registered: April 2018
Junior Member
Hi,

I read with great interest the Logger snippet on the Snippets page in the docs.

For a sanity test I tried to run it exactly as it is posted. Note that the post has compile errors, this is how I fixed it:
https://gist.github.com/janos-ss/775681899842947eb7472220890e293b#file-loggertest-java

And if I run this, I get the following failures:
-------------------------------------------------------------------------------
Test set: org.sonarlint.eclipse.its.LoggerTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.101 sec <<< FAILURE! - in org.sonarlint.eclipse.its.LoggerTest
org.sonarlint.eclipse.its.LoggerTest  Time elapsed: 0.095 sec  <<< ERROR!
java.lang.IllegalArgumentException: Logging bundle must not be null.
	at org.eclipse.core.internal.runtime.Log.<init>(Log.java:30)
	at org.eclipse.core.internal.runtime.InternalPlatform.getLog(InternalPlatform.java:351)
	at org.eclipse.core.runtime.Platform.getLog(Platform.java:976)
	at org.sonarlint.eclipse.its.LoggerTest.getLog(LoggerTest.java:56)
	at org.sonarlint.eclipse.its.LoggerTest.registerLog(LoggerTest.java:47)

org.sonarlint.eclipse.its.LoggerTest  Time elapsed: 0.101 sec  <<< ERROR!
java.lang.IllegalArgumentException: Logging bundle must not be null.
	at org.eclipse.core.internal.runtime.Log.<init>(Log.java:30)
	at org.eclipse.core.internal.runtime.InternalPlatform.getLog(InternalPlatform.java:351)
	at org.eclipse.core.runtime.Platform.getLog(Platform.java:976)
	at org.sonarlint.eclipse.its.LoggerTest.getLog(LoggerTest.java:56)
	at org.sonarlint.eclipse.its.LoggerTest.unregisterLog(LoggerTest.java:52)


The problem seems to be that Platform.getBundle("org.eclipse.swtbot") returns null, and I don't know how to fix that. Any ideas?

Thanks,
Janos

PS: It would be good to fix the Snippets page, because the example as given doesn't compile.
Re: How to make the Logger snippet work [message #1786080 is a reply to message #1785371] Wed, 25 April 2018 09:54 Go to previous message
Aparna Argade is currently offline Aparna ArgadeFriend
Messages: 44
Registered: October 2010
Member
You can give your plug-ID (i.e. ID in Overview tab of MANIFEST.MF of your plugin) as argument to Platform.getBundle.
Alternatively, you may try org.apache.log4j.Logger as mentioned at https://wiki.eclipse.org/SWTBot/FAQ#How_do_I_configure_log4j_to_turn_on_logging_for_SWTBot.3F
Previous Topic:SWTBot tests do not work with maven, but with Eclipse
Next Topic:How to open a menu?
Goto Forum:
  


Current Time: Wed Sep 19 01:53:49 GMT 2018

Powered by FUDForum. Page generated in 0.02012 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top