logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Deboy <scott.de...@gmail.com>
Subject Log4j2 plugin resolution
Date Thu, 14 Mar 2013 05:52:06 GMT
After working through the 'left out to attempt to get around spam blocker'
plugin support, I noticed something that I think may be an issue.

I have a default/no-op 'left out' implementation:
@Plugin(name = "default", type = "Core", elementType = "left out",
printObject = false)
public class DefaultLeftOut implements LeftOut {

If some other person names another plugin as 'default' in 'core'
(admittedly default is a terrible name and I should rename it)...we will
have a problem.

I think the element type should be part of the resolution..

Still using:
PluginManager pluginManager = new PluginManager("Core");
pluginManager.collectPlugins();

But instead of code using:
PluginType type = getPluginManager().getPluginType(name);
(with name = 'default' in this LeftOut case, giving me a DefaultLeftOut)

Maybe:
PluginType type = getPluginmanager().getPluginType(elementType, name);
(with elementType = 'leftOut' and name = 'default' in this leftOut case)

In theory, we should also update the Maps in pluginmanager to support this
uniqueness...right now we collide just on 'name' in the type.

Right now, the last one wins, which isn't ideal.

At least we'd reduce the likelihood of collisions.

What do you think?

Mime
View raw message