Log4E Preferences |
||
The Plugin is high configurable. You can configure almost everything to adapt your logger to your needs. It is highly recommended to check the preferences before using the Plugin the first time.
The most important part of the preferences are the templates. They affect which
logger should be used. |
||
Overview
|
||
FormatOptions:
The delimiter is important when performing "Modification"! The delimiter is used in the templates section ("Log4E > Profile > Templates")
logger.debug("myMethod() - my message : int i = " + i); It should be different to the Delimiter above The delimiter is used in the templates section ("Log4E > Profile > Templates")
Example: logger.debug("myMethod(String) - start");
Example: logger.debug("myMethod(String) - start");
|
||
Imports and DeclarationImports Tab
Options:
Declaration TabOptions:
As a result the logger imports and declaration is automatically inserted like in that example:
import org.apache.log4j.Logger; public class MyClass { /** * Log4J Logger for this class */ private static final Logger logger = Logger.getLogger(MyClass.class); |
||
PositionsLog4E inserts logger statements at certain method entries. You can specify the behaviour for each entry differently. The entries are separated in different tabs.
Tab Method StartIt defines the very beginning of the method. The logger statement is inserted there. If method is a constructor and does a constructor invocation (i.e. this(), super()) the logger statement is inserted right behind the invocation. Options:
Example: logger.debug("myMethod(String) - start");
Example: logger.debug("myMethod(arg1 = " + arg1 + ") - start");
Example: logger.debug("myMethod(String) - start");
As a result the logger statements are automatically inserted like in that example:
public String myMethod(String arg1) {
if (logger.isDebugEnabled()) {
logger.debug("myMethod(String arg1 = " + arg1 + ") - start");
}
//Your code....
}
Tab Method Exit
It defines the exit point of a method. That could be a return statement
or a the end of the method. The settings are the same as at start position except one: Options:
Example:
Before: public String myMethod(String arg1) { //Your code.... return toString(); }
After: public String myMethod(String arg1) { //Your code.... String returnString = toString(); logger.debug("myMethod() - end - return value = " + returnString); return returnString; }
Tab Catch BlockIt defines the position in a try - catch block. Normally a logger with ERROR level is inserted here providing the given exception. The settings are the same as at start position.
Tab Other
It defines all other positions than "Method Start", "Method Exit"
or "Catch Block". The settings are reduced to the needed information. |
||
StatementsOptions:
The statements themselves are defined in "Log4E > Profiles > Templates > Is<Level>Enabled Statements" and "Log4E > Profiles > Templates > Is<Position>Enabled Statements" As a result the logger statements are automatically inserted like in that example:
public String myMethod(String arg1) { if (logger.isDebugEnabled()) { logger.debug(...); } //Your code.... } |
||
Templates
The most important part of the preferences are the templates. They affect which
logger should be used. Options:
|
||
Template DefinitionsAfter presssing "Show" or "Edit" a popup window with the definitions is shown.
Variables
Example: logger.debug("myMethod() - my message : int i = " + i);
Declaration TabOptions:
If this field is left blank, the logger will be declared without initialising it. That could be done in the constructor for instance. As a result the logger imports and declaration is automatically inserted like in that example:
import org.apache.log4j.Logger; public class MyClass { Logger logger = Logger.getLogger(MyClass.class); Level Statements Tab
You can specify level statements for any of these
levels: Note that these level and methods are not available for all loggers (e.g. Log4j doesn't support TRACE, but the Apache Commons Logger does). Options:
example: trace("${enclosing_method}${delimiter}${message}${delimiter}${return_value}") As a result the logger statements are automatically inserted like in that example:
public String myMethod(String arg1) { logger.debug("myMethod() - start"); //Your code.... logger.debug("myMethod() - start - return value = myString"); return "myString"; } Is<Level>Enabled Statements Tab
Define the methods which check the level before executing the log statement here. Options:
example: isTraceEnabled() or isLoggable(Level.FINER) As a result the logger statements are automatically inserted like in that example:
public String myMethod(String arg1) { if (logger.isDebugEnabled()) { logger.debug(...); } //Your code.... } Position Statements Tab"Position Statements" is an alternative to the level statements described above. They are introduced in JDK 1.4 logging and are special statements for particular method entries: Options:
As a result the logger statements are automatically inserted like in that example:
public String myMethod(String arg1) { logger.entering("MyClass", "myMethod()", "start"); //Your code.... logger.entering("MyClass", "myMethod()", "end - return value = myString"); return "myString"; } Is<Position>Enabled Statements TabThese statements are equivalent to the Is<Level>Enabled Statements described above. Options:
This statement is only used if specified in the "Log4E > Profile > Statements" preference page.
This statement is only used if specified in the "Log4E > Profile > Statements" preference page.
This statement is only used if specified in the "Log4E > Profile > Statements" preference page. As a result the logger statements are automatically inserted like in that example:
public String myMethod(String arg1) { if isLoggable(Level.FINER) { logger.entering(...); } //Your code.... } |
||
Replacement
Log4E replaces System.out.println, System.out.print, System.err.println, System.err.print
and e.printStackTrace statements. Options:
|
||
User InteractionOptions:
|
||
|