File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
src/main/java/xyz/theprogramsrc/supercoreapi Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 66
77 <groupId >xyz.theprogramsrc</groupId >
88 <artifactId >SuperCoreAPI</artifactId >
9- <version >3.3.1 </version >
9+ <version >3.3.2 </version >
1010 <packaging >jar</packaging >
1111
1212 <name >SuperCoreAPI</name >
Original file line number Diff line number Diff line change 11package xyz .theprogramsrc .supercoreapi ;
22
3+ import org .apache .logging .log4j .LogManager ;
4+ import org .apache .logging .log4j .core .Logger ;
5+ import xyz .theprogramsrc .supercoreapi .global .LogsFilter ;
36import xyz .theprogramsrc .supercoreapi .global .dependencies .DependencyManager ;
47import xyz .theprogramsrc .supercoreapi .global .translations .TranslationManager ;
58import xyz .theprogramsrc .supercoreapi .global .translations .TranslationPack ;
@@ -158,4 +161,13 @@ default String getPluginMessagingChannelName(){
158161 * Stops the plugin
159162 */
160163 void emergencyStop ();
164+
165+ /**
166+ * Registers a log filter
167+ * @param logsFilter the filter
168+ */
169+ default void registerLogFilter (LogsFilter logsFilter ){
170+ Logger consoleLogger = (Logger ) LogManager .getRootLogger ();
171+ consoleLogger .addFilter (logsFilter );
172+ }
161173}
Original file line number Diff line number Diff line change @@ -17,7 +17,9 @@ public abstract class MySQLDataBase implements DataBase{
1717 public MySQLDataBase (SuperPlugin <?> plugin ){
1818 this .plugin = plugin ;
1919 this .plugin .log ("Connecting to '" + getDataBaseSettings ().host () + ":" + getDataBaseSettings ().port ()+"'..." );
20- new LogsFilter (LogsFilter .FilterResult .DENY , "com.zaxxer.hikari" );
20+ if (this .hideHikariLogs ()){
21+ this .plugin .registerLogFilter (new LogsFilter (LogsFilter .FilterResult .DENY , "com.zaxxer.hikari" ));
22+ }
2123 HikariConfig cfg = new HikariConfig ();
2224 cfg .setJdbcUrl ("jdbc:mysql://" + getDataBaseSettings ().host () + ":" + getDataBaseSettings ().port () + "/" + getDataBaseSettings ().database () + "?useSSL=" + getDataBaseSettings ().useSSL ());
2325 cfg .setUsername (getDataBaseSettings ().username ());
@@ -70,4 +72,11 @@ public void connect(ConnectionCall call) {
7072 ex .printStackTrace ();
7173 }
7274 }
75+
76+ /**
77+ * @return true to hide the hikaricp logs, otherwise false
78+ */
79+ public boolean hideHikariLogs (){
80+ return true ;
81+ }
7382}
You can’t perform that action at this time.
0 commit comments