JLOG
Log injection is widely adopted in projects at all levels, being a vital activity in software development. It aims to assist and facilitate developers in code debugging and maintenance. Challenges associated with logging have been identified by researchers, such as determining where to log, what information to include in logs, and selecting the appropriate log level (e.g. debug, fatal). With the aim of automating logging activities, researchers have developed techniques capable of automatically injecting log statements into methods. However, despite the implementation of simple prototypes leveraging such techniques, there are currently no tools available for practitioners that can be easily adapted to support state-of-the-art recommender Models for automating loggging activities, making it difficult for researchers and developers to experiment with different approaches. To address this gap, this project proposes JLOG, a plugin developed for Visual Studio Code (VSCode), the most widely used IDE on the market. This plugin integrates seamlessly with the VSCode user interface and suggests log statements in the working text editor, that developers can then accept or reject using specific combinations of keyboard shortcuts.
Features
For log generation and injection, this plugin makes advantage of a fairly robust T5 plugin implementation, called LEONID. The text-editor will display the neural network's suggestions right away.
You may deploy your own model on a server and write the required URLs in the plugin's settings if you are not happy with the predictions made by the default model.
Extension Settings
This extension contributes the following settings:
loginjector.enable
: enable/disable this extension
Default: true
loginjector.urlClassifier
: The server's URL hosting the neural network that classifies methods as 'needing' or 'not needing' log statements.
Default: http://gym.si.usi.ch:45010/classifier/
loginjector.urlInjector
: The server'S URL hosting the neural network that generates the log suggestions.
Default: http://gym.si.usi.ch:45010/leonid/
loginjector.urlFeedback
: The server's URL hosting the feeback database.
Default: http://gym.si.usi.ch:45011/feedback/
loginjector.name
: Insert your organization name. This setting is optional.
loginjector.suggestionColor
: The suggestion's color expressed in hexadecimal. Different themes may make the default color not visible, so it is suggested to change it to fit the current theme.
Default: #adadad
loginjector.confidenceThreshold
: The minimum confidence that the neural network must have to show a recommendation. If the confidence for the current suggestion is below the threshold, it will not be shown.
Default: 75
loginjector.activateAutomaticTrigger
: Activate the automatic trigger of the extension.
Default: False
loginjector.triggerInterval
: Interval in seconds between each of the automatic activations. The possible values are from 5 and 60.
Default: 30
Commands
The extension offers some default commands and related keybindings. The keys used change behavior depending on the extension's state, meaning that it is still possible to use enter
to create a new line, and only when suggestions are showing it will behave as trigger for the respective command. The other keybindings work the same way.
backspace
: reject the suggestions being shown
enter
: accept the suggestions being shown
ctrl+space
: manually invoke the extension on a specific method
Folder structure
package.json
- This is the manifest file where you list your commands and extensions. A command is registered by the plugin, and its title and command name are specified. VS Code can display the command in the command palette using this information.
src/
- The folder contains the javascript codebase that builds the plugin.
language-configuration.json
- This file disables automatic parenthesis closing, which is required for the correct operation of the plugin.
report.pdf
- pdf file containing a thorough description of the plugin.
Notes:
- The plugin turns off automatic closing of (, [ and {.
- If on first execution VSCode shows a text box that says "no formatter found", it is necessary to press of "choose a parser", and in the list that vscode will show near the top there will be the name of the extension, JLOG. That is the correct formatter that is shipped with the extension.