Ganymede
Monitor Log4J logs withing Eclipse.
Download Ganymede 0.9.2.1 for EasyEclipse 1.2.2:
Ganymede display logging events coming from applications that use Log4j. You must configure the application to use a remote logger, and, once the included Log4j server is started, log entries will appear on the Ganymede view. It includes color, filtering, detailed information, and saves settings.
Comments are currently disabled on this page.'; ?>
Installing this plugin
This plugin is not shipped in any distribution. You must manually install it on an EasyEclipse distribution.
The dependent plugin Eclipse Java Development Tools must be present in the EasyEclipse distribution you use, or must be installed separately.
Getting started
To use Ganymede, your application must use Log4j. You can download the latest version of the log4j library from the Log4j website.
To start using Ganymede, here is a basic tutorial:
- Create a new java project by selecting File > New > Project, then Java > Java project. Give the project a name, and click OK.
- Create a new Java file by selecting File > New > File, call it
Main.java. Paste the following code in the file, and save:import java.util.Properties; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; public class Main { public static void main(String argv[]) { Properties p = new Properties(); p.setProperty("log4j.rootCategory", "debug,stdout,ganymede"); p.setProperty("log4j.appender.stdout", "org.apache.log4j.ConsoleAppender"); p.setProperty("log4j.appender.stdout.layout", "org.apache.log4j.PatternLayout"); p.setProperty("log4j.appender.ganymede", "org.apache.log4j.net.SocketAppender"); p.setProperty("log4j.appender.ganymede.remoteHost", "localhost"); p.setProperty("log4j.appender.ganymede.port", "4445"); p.setProperty("log4j.appender.ganymede.locationInfo", "true"); PropertyConfigurator.configure(p); Logger logger = Logger.getLogger("main"); logger.error("Test error."); } } - Add the Log4j library to the project, by selecting Project > Properties, then Java Build Path, and, in the Libraries tab, click add external Jars, locate the log4j jar file that you have downloaded and extracted, and click OK.
- The project should compile (no error in the Problems view.
- Run the project by selecting Run > Run As > Eclipse Application: an exception
log4j:ERROR Could not connect to remote log4j server at [localhost]. We will try again later. java.net.ConnectException: Connection refusedshould appear in the Console view. This is correct since there's no server running. - Open, or display, the Ganymede Log4j View. push the button "Start Log4J server" on the upper right of the view.
- Run the project again: it does not throw exception anymore. This is correct since the server is now running.
- An event may be visible in the Ganymede Log4j View. If nothing appear, you must select the columns to display (no column is displayed by default)).
Select Window > Preferences..., then Ganymede Log4j View > Columns, click Add Column for a view values in the column drop-down. The log should be visible now.
Tests
(Notes that tests are only displayed if the page is served statically)- Passing:
- download and unzip log4j from http://apache.tradebit.com/pub/logging/log4j/1.2.14/logging-log4j-1.2.14.zip - new java project, name, Ok - new Java file, call it Main.java, paste: import java.util.Properties; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; public class Main { public static void main(String argv[]) { Properties p = new Properties(); p.setProperty("log4j.rootCategory", "debug,stdout,ganymede"); p.setProperty("log4j.appender.stdout", "org.apache.log4j.ConsoleAppender"); p.setProperty("log4j.appender.stdout.layout.ConversionPattern", "%5p [%t] (%F:%L) - %m%n"); p.setProperty("log4j.appender.stdout.layout", "org.apache.log4j.PatternLayout"); p.setProperty("log4j.appender.ganymede", "org.apache.log4j.net.SocketAppender"); p.setProperty("log4j.appender.ganymede.remoteHost", "localhost"); p.setProperty("log4j.appender.ganymede.port", "4445"); p.setProperty("log4j.appender.ganymede.locationInfo", "true"); PropertyConfigurator.configure(p); Logger logger = Logger.getLogger("any"); logger.error("Test error."); } } - project properties, Java Build Path, libraries, "add external Jars", select log4j-1.2.14.jar, OK - project should compile - run project: it throws exception in console (this is correct since there\'s no server running): log4j:ERROR Could not connect to remote log4j server at [localhost]. We will try again later. java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) - go to Ganymede Log4j view, push the button "Start Log4J server" - run project: does not throw exception again (this is correct since the server is now running) -
Useful links
- Ganymede home
- Ganymede provides support for the Apache Log4J library.
Changelog
Changes in EasyEclipse 1.0.0:
- Initial release (with Ganymede 0.9.2).
Credits and License
Credits: Brandon Opfermann
Copyright (c) Brandon Opfermann.
This plugin is licensed under the GNU General Public License 2.0 license.
(612KB)
(572KB)
(496KB)