On 08/11/2016 15:33, Sergiu Dumitriu wrote:

I don't see how this works. Who calls setLog?

The ToolContext.putVelocityEngine(engine) does:

  putToolProperty(LOG_KEY, engine.getLog());

so "log" becomes a standard property which calls setLog() by introspection on tools when present.

Basically, doing params.get("log") in the tool's configure method is exactly the same as having a setLog(log) method.

The standard way of using loggers is to have each class instantiate its
own Logger object, so that the logs correctly indicate the class where
the message was generated:

private static final Logger LOG = LoggerFactory.getLogger(SomeTool.class);

Other ways of setting an explicit logger should be deprecated/removed.

Just my 2 cents.

Well, in 95% of the code of the engine and the tools, the current behavior is to rely on and pass over the engine log, so I just homogenized the remaining 5% to be consistent.

Going the other way, and let each class have its log, has pros and cons, yes you know from where the log comes from, but you may want not to export internal class names and instead have a single logger called "Velocity".

For the tools, it makes more sense, though. I see that some log messages are prefixed with the tool name, but not all.


  Claude

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to