<commit_before><commit_msg>Handle plugin prefixes using Log4J<commit_after>From 135570bf38bcf55248ff39becce8e8af625a0a13 Mon Sep 17 00:00:00 2001
From: Minecrell <<EMAIL>>
Date: Fri, 22 Sep 2017 13:07:31 +0200
Subject: [PATCH] Handle plugin prefixes using Log4J


diff --git a/api/src/main/java/net/md_5/bungee/api/plugin/Plugin.java b/api/src/main/java/net/md_5/bungee/api/plugin/Plugin.java
index bc91208a..e85b4914 100644
--- a/api/src/main/java/net/md_5/bungee/api/plugin/Plugin.java
+++ b/api/src/main/java/net/md_5/bungee/api/plugin/Plugin.java
@@ -85,7 +85,7 @@ public class Plugin
         this.proxy = proxy;
         this.description = description;
         this.file = description.getFile();
-        this.logger = new PluginLogger( this );
+        this.logger = Logger.getLogger(description.getName()); // Waterfall - Handle plugin prefixes in implementation
     }
 
     //
diff --git a/log4j/src/main/resources/log4j2.xml b/log4j/src/main/resources/log4j2.xml
index d4a81199..3664f30e 100644
--- a/log4j/src/main/resources/log4j2.xml
+++ b/log4j/src/main/resources/log4j2.xml
@@ -2,10 +2,20 @@
 <Configuration status="warn">
     <Appenders>
         <TerminalConsole name="TerminalConsole">
-            <PatternLayout pattern="%highlightError{[%d{HH:mm:ss} %level]: %minecraftFormatting{%msg}%n%xEx}" />
+            <PatternLayout>
+                <LoggerNamePatternSelector defaultPattern="%highlightError{[%d{HH:mm:ss} %level] [%logger]: %minecraftFormatting{%msg}%n%xEx}">
+                    <!-- Log root and BungeeCord loggers without prefix -->
+                    <PatternMatch key=",BungeeCord" pattern="%highlightError{[%d{HH:mm:ss} %level]: %minecraftFormatting{%msg}%n%xEx}" />
+                </LoggerNamePatternSelector>
+            </PatternLayout>
         </TerminalConsole>
         <RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz" immediateFlush="false">
-            <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %minecraftFormatting{%msg}{strip}%n" />
+            <PatternLayout>
+                <LoggerNamePatternSelector defaultPattern="[%d{HH:mm:ss}] [%t/%level] [%logger]: %minecraftFormatting{%msg}{strip}%n">
+                    <!-- Log root and BungeeCord loggers without prefix -->
+                    <PatternMatch key=",BungeeCord" pattern="[%d{HH:mm:ss}] [%t/%level]: %minecraftFormatting{%msg}{strip}%n" />
+                </LoggerNamePatternSelector>
+            </PatternLayout>
             <Policies>
                 <TimeBasedTriggeringPolicy />
                 <OnStartupTriggeringPolicy />
-- 
2.14.1


{'fraction_non_alphanumeric': 0.15833333333333333, 'fraction_numerical': 0.045454545454545456, 'mean_word_length': 3.0444104134762635, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6201914', 'n_tokens_mistral': 961, 'n_tokens_neox': 869, 'n_words': 134}