General
Install
Installing a plugin is not difficult and you may already familiar with that process. But note that the Plugin's identifier changed to '..._free' and '..._pro' which makes it necessary to uninstall previous versions before.This is a failsafe guide to install the plugin. Consider that your Eclipse version is installed in C:\Program Files\eclipse:
- Shutdown Eclipse
- Delete the directory C:\Program Files\eclipse\features\de.jayefem.log4e_xxx on your file system (your previous settings will be NOT deleted)
- Delete both directories C:\Program Files\eclipse\plugins\de.jayefem.log4e_xxx and C:\Program Files\eclipse\plugins\de.jayefem.log4e.help_xxx on your file system (your previous settings will be NOT deleted)
- Start Eclipse
- Use the Update Manager of Eclipse as decribed in Download OR download the zip-file from the Download section and unzip it to C:\Program Files\eclipse
- Restart Eclipse
- If the installation failed start Eclipse again with the '-clean' parameter
Menus
Log4E can be invoked from several menus and context menus
Main menu Edit
Log4E defines a submenu in the main menu "Edit". It provides the same functionality as the Context menu of a Java editor. This menu has to be enabled once. See more at the Enable shortcuts section.
Context menu Java editor
Declare logger
See Logger Declaration.
Log this variable
See Insertions for selected variable for more information.
Log at this position...
This task has been formerly called "Insert Log Statement At This Position...". See Insert at certain position for more information.
Log this method
This task has been formerly called "Insert Log Statements For This Method". See Insertions for method/class for more information.
Log this class
This task has been formerly called "Insert Log Statements For This Class". See Insertions for method/class for more information.
Re-apply in this method
This task has been formerly called "Modify Log Statements For This Method". See Logger Modification for more information.
Re-apply in this class
This task has been formerly called "Modify Log Statements For This Class". See Logger Modification for more information.
Substitute System.out's in this method
This task has been formerly called "Replace System.out's For This Method". See Substitution of System out's for more information.
Substitute System.out's in this class
This task has been formerly called "Replace System.out's For This Class". See Substitution of System out's for more information.
Context menu package explorer
The context menu in the package explorer provides only tasks that can be invoked on class level except when selecting a method in the package explorer (which is possible now).Log4E provides multiple selection on project/source folder/package/class level [Pro version only]. See the Multiple files section for more information.
Shortcuts
Since version 1.0.0 shortcuts are enabled for Log4E. Eclipse provides the possibility to re-define them. The shortcuts are defined in the menu Edit. Usually they have to be enabled once.
Enable shortcuts
To enable the submenu in the main menu Edit and enable the shortcuts, follow the these steps:- Go to the main menu "Window > Customize Perspective ..."
- Choose the tab "Commands" in the popup window
- Select "Log4E" from the list "Available command groups:"
- Press OK
- The submenu should now appear in the menu "Edit"
Key definitions
Declare logger Default: Ctrl+Alt+D Emacs: Ctrl+Alt+L Ctrl+D
Log this variable Default: Ctrl+Alt+P Emacs: Ctrl+Alt+L Ctrl+P
Log at this position... Default: Ctrl+Alt+O Emacs: Ctrl+Alt+L Ctrl+O
Log this method Default: Ctrl+Alt+I Emacs: Ctrl+Alt+L Ctrl+I
Log this class Default: Ctrl+Alt+U Emacs: Ctrl+Alt+L Ctrl+U
Re-apply in this method Default: Ctrl+Alt+M Emacs: Ctrl+Alt+L Ctrl+M
Re-apply in this class Default: Ctrl+Alt+N Emacs: Ctrl+Alt+L Ctrl+N
Substitute System.out's in this method Default: Ctrl+Alt+R Emacs: Ctrl+Alt+L Ctrl+R
Substitute System.out's in this class Default: Ctrl+Alt+E Emacs: Ctrl+Alt+L Ctrl+E
Key Re-definition
In Eclipse you can re-define any shortcut you like. Follow these steps:- Go to the main menu "Window > Preferences"
- Select the page "Workbench -> Keys" in the popup window
- Choose the tab "Keyboard shortcuts"
- Select "Edit" as "Category:"
- Re-define the key bindings of the "Name:"
Preview wizard
Multiple files [Pro version only]
Log4E provides multiple file selection either on project, source folder, package or class level. If multiple files were selected, you can browse them in the preview wizard and confirm or decline the changes the at once. The preview wizard will only shown up if specified in Preferences.
Edit source code [Pro version only]
In the preview wizard you have the possibility to edit the modified source code before confirming the changes. Just put the text cursor anywhere you like in the "Modified Source" editor and edit the source. Save the code by right clicking into the editor and click "Save".button explanation:
- "Copy All from Left to Right": Undo all changes
- "Copy Current Change from Left to Right": Undo current change
Templates
The most important part of the preferences are the templates. They affect which logger should be used.
Choose your logger
Templates are defined in the Log4E preferences page. Several predefined templates are available (Log4j, Commons Logging, JDK 1.4 logging and ATG logging).One is able to adapt the templates to his or her own logger. [Pro version only]
Define your own templates [Pro version only]
See Template Definitions for more information.
Static logger
If using a "static logger" i.e. a class that provides static logging methods, you have to adapt your preferences in Log4E > Imports and Declaration:
- deselect the checkboxes "Declare Logger when performing 'Log' or 'Substitue'" and "Declare Logger when performing 'Declare Logger'" in the "Declaration Tab".
- put the class name of your logger in "Logger Name" in the "Declaration Tab".