SystemLog: fix duplicated log lines after reloading a plugin

Every time a plugin using 'SystemLog.createAsyncAppender' was reloaded,
repeated log messages were added to the log file. So, e.g., the first
time the plugin was reloaded the log messages were duplicated, the next
reload caused the log messages to be written 3 times and so on.
Plugins affected so far include Replication, delete-project and Importer.

The problem was an appender being added to the plugin logger at each
reload. A mechanism was previously added to remove an existing appender
when reloading a plugin to avoid this problem, but it relies in the
appender's name to be able to identify and remove an existing appender.
The appender's name, however, was never set in the 'createAsyncAppender'
method. In that way, when the plugin was reloaded, the old appender was
never removed and a new one was added, explaining the multiplication of
lines in the log output.

Fix this by setting the appender's name. Hence, allow the appender to be
correctly identified and removed when the plugin is reloaded.

Change-Id: I1118aa69416374a6ff31644ad499655146244124
This commit is contained in:
Hector Oswaldo Caballero
2015-09-25 10:17:37 -04:00
committed by David Pursehouse
parent c4e85f0ae3
commit 1f5af647d8

View File

@@ -72,6 +72,7 @@ public class SystemLog {
public AsyncAppender createAsyncAppender(String name, Layout layout) {
AsyncAppender async = new AsyncAppender();
async.setName(name);
async.setBlocking(true);
async.setBufferSize(config.getInt("core", "asyncLoggingBufferSize", 64));
async.setLocationInfo(false);