| Re-Application Algorithm |
|
|
|
To analyse the existing log statement in source code, Log4E uses the accordingly template (defined in Log4E > Templates preference page) Example 1Assume the existing log statement is:
Therefore the accordingly template is:
Log4E makes a guess to map the tokens to the right variables. In this case, assuming that ${delimiter}=" - ", everything is alright. The mapping would be: ${enclosing_method}="otherMethod()" Only the ${message} is kept. Everything else will be replaced with the computed values. The result would be:
To compute the right tokens Log4E uses the delimiter. If the delimiter, defined in the <a href="preferences.html#Format">"Log4E > Format"</a> preferences, is different to delimiter used in the source code, Log4E won't be able to extract the user message. Example 2Assume the existing log statement is:
Therefore the accordingly template is:
In this case, assuming that ${delimiter}=" - ", the mapping would be: ${enclosing_method}="otherMethod() : starttext" When Log4E recognizes that the ${message} is empty it will pop up a warning. The user can choose from there if he or she wants to start the Preview Wizard before confirming the changes. If confirmed by user the result would be:
Note that the logger statement "error("otherMethod()", e)" generated by Log4E doesn't have a message by default. Therefore Log4E will pop up a warning when performing modification even if the message must be empty in this case. Example 3 (worst case)Assume the existing log statement is:
Therefore the accordingly template is:
In this case, assuming that ${delimiter}=" - ", the mapping would be: ${enclosing_method}="starttext" This is the worst case. Log4E does not recognize that the mapping is wrong because ${message} is not empty. Log4E would delete the exisitng message without a warning:
AbstractThe modification task is best used with Log4E generated log statements! |




