Make LogContext optional. This can be useful for debugging mod issues, but

Apache's implementation in log4j2 is responsible for a very significant % of
the overall runtime. Quite frankly this is shockingly bad performance from
what is supposed to be a high performance logging framework. Anyway, until we
can figure out if we can fix it, we're turning it off by default.
This commit is contained in:
Christian 2014-07-29 21:48:14 -02:30
parent 655d902195
commit f8b5ae45f1
1 changed files with 5 additions and 3 deletions

View File

@ -22,6 +22,7 @@ public class ASMEventHandler implements IEventListener
private static final String HANDLER_FUNC_DESC = Type.getMethodDescriptor(IEventListener.class.getDeclaredMethods()[0]);
private static final ASMClassLoader LOADER = new ASMClassLoader();
private static final HashMap<Method, Class<?>> cache = Maps.newHashMap();
private static final boolean GETCONTEXT = Boolean.parseBoolean(System.getProperty("fml.LogContext", "false"));
private final IEventListener handler;
private final SubscribeEvent subInfo;
@ -36,11 +37,11 @@ public class ASMEventHandler implements IEventListener
@Override
public void invoke(Event event)
{
if (owner != null)
if (owner != null && GETCONTEXT)
{
ThreadContext.put("mod", owner.getName());
}
else
else if (GETCONTEXT)
{
ThreadContext.put("mod", "");
}
@ -51,7 +52,8 @@ public class ASMEventHandler implements IEventListener
handler.invoke(event);
}
}
ThreadContext.remove("mod");
if (GETCONTEXT)
ThreadContext.remove("mod");
}
public EventPriority getPriority()