Merge branch 'master' into add-MultiProperties

This commit is contained in:
LamGC 2020-05-06 10:18:00 +08:00
commit b969bb29b2
18 changed files with 19 additions and 22 deletions

View File

@ -42,7 +42,7 @@ import java.util.zip.ZipOutputStream;
@SpringBootApplication @SpringBootApplication
public class Main { public class Main {
private final static Logger log = LoggerFactory.getLogger("Main"); private final static Logger log = LoggerFactory.getLogger(Main.class.getName());
private final static File storeDir = new File("store/"); private final static File storeDir = new File("store/");

View File

@ -20,7 +20,7 @@ import java.util.*;
public class BotAdminCommandProcess { public class BotAdminCommandProcess {
private final static Logger log = LoggerFactory.getLogger(BotAdminCommandProcess.class.getSimpleName()); private final static Logger log = LoggerFactory.getLogger(BotAdminCommandProcess.class.getName());
private final static File pushListFile = new File(System.getProperty("cgj.botDataDir"), "pushList.json"); private final static File pushListFile = new File(System.getProperty("cgj.botDataDir"), "pushList.json");

View File

@ -39,7 +39,7 @@ public class BotCommandProcess {
private final static PixivDownload pixivDownload = new PixivDownload(Main.cookieStore, Main.proxy); private final static PixivDownload pixivDownload = new PixivDownload(Main.cookieStore, Main.proxy);
private final static Logger log = LoggerFactory.getLogger(BotCommandProcess.class.getSimpleName()); private final static Logger log = LoggerFactory.getLogger(BotCommandProcess.class.getName());
private final static File imageStoreDir = new File(System.getProperty("cgj.botDataDir"), "data/image/cgj/"); private final static File imageStoreDir = new File(System.getProperty("cgj.botDataDir"), "data/image/cgj/");
private final static Gson gson = new GsonBuilder() private final static Gson gson = new GsonBuilder()

View File

@ -52,8 +52,6 @@ public enum MessageEventExecutionDebugger {
} }
}); });
public final static String debuggerLoggerNameTemp = "MessageEventExecuteDebugger-{debugger}";
public final MessageExecuteDebugger debugger; public final MessageExecuteDebugger debugger;
MessageEventExecutionDebugger(MessageExecuteDebugger debugger) { MessageEventExecutionDebugger(MessageExecuteDebugger debugger) {
@ -61,7 +59,7 @@ public enum MessageEventExecutionDebugger {
} }
public static Logger getDebuggerLogger(MessageEventExecutionDebugger debugger) { public static Logger getDebuggerLogger(MessageEventExecutionDebugger debugger) {
return LoggerFactory.getLogger(debuggerLoggerNameTemp.replace("{debugger}", debugger.name())); return LoggerFactory.getLogger(MessageEventExecutionDebugger.class.getName() + "." + debugger.name());
} }
@FunctionalInterface @FunctionalInterface

View File

@ -14,7 +14,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class RandomIntervalSendTimer extends TimerTask { public class RandomIntervalSendTimer extends TimerTask {
private final static Timer timer = new Timer("Thread-RIST"); private final static Timer timer = new Timer("Thread-RIST");
private final static Logger log = LoggerFactory.getLogger("RandomIntervalSendTimer"); private final static Logger log = LoggerFactory.getLogger(RandomIntervalSendTimer.class.getName());
private final static Map<Long, RandomIntervalSendTimer> timerMap = new HashMap<>(); private final static Map<Long, RandomIntervalSendTimer> timerMap = new HashMap<>();
private final long timerId; private final long timerId;

View File

@ -39,7 +39,7 @@ public class RandomRankingArtworksSender extends AutoSender {
super(messageSender); super(messageSender);
this.mode = mode; this.mode = mode;
this.contentType = contentType; this.contentType = contentType;
log = LoggerFactory.getLogger("RecommendArtworksSender@" + Integer.toHexString(this.hashCode())); log = LoggerFactory.getLogger(this.toString());
this.rankingStart = rankingStart > 0 ? rankingStart : 1; this.rankingStart = rankingStart > 0 ? rankingStart : 1;
this.rankingStop = rankingStop > 0 ? rankingStop : 150; this.rankingStop = rankingStop > 0 ? rankingStop : 150;
if(this.rankingStart > this.rankingStop) { if(this.rankingStart > this.rankingStop) {

View File

@ -17,7 +17,7 @@ public class HotDataCacheStore<T> implements CacheStore<T> {
private final long expireTime; private final long expireTime;
private final int expireFloatRange; private final int expireFloatRange;
private final Random random = new Random(); private final Random random = new Random();
private final Logger log = LoggerFactory.getLogger(HotDataCacheStore.class.getSimpleName() + "@" + Integer.toHexString(this.hashCode())); private final Logger log = LoggerFactory.getLogger(this.toString());
/** /**
* 构造热点缓存存储对象 * 构造热点缓存存储对象

View File

@ -21,7 +21,7 @@ import java.util.Set;
public class ImageCacheHandler implements EventHandler { public class ImageCacheHandler implements EventHandler {
private final static Logger log = LoggerFactory.getLogger("ImageCacheHandler"); private final static Logger log = LoggerFactory.getLogger(ImageCacheHandler.class.getName());
private final static HttpClient httpClient = HttpClientBuilder.create().setProxy(Main.proxy).build(); private final static HttpClient httpClient = HttpClientBuilder.create().setProxy(Main.proxy).build();

View File

@ -36,7 +36,7 @@ public abstract class RedisPoolCacheStore<T> implements CacheStore<T> {
if(jedisPool.isClosed()) { if(jedisPool.isClosed()) {
throw new IllegalStateException("JedisPool is closed"); throw new IllegalStateException("JedisPool is closed");
} }
log = LoggerFactory.getLogger(this.getClass().getSimpleName() + "@" + Integer.toHexString(jedisPool.hashCode())); log = LoggerFactory.getLogger(this.getClass().getName() + "@" + Integer.toHexString(jedisPool.hashCode()));
if(!Strings.isNullOrEmpty(keyPrefix)) { if(!Strings.isNullOrEmpty(keyPrefix)) {
this.keyPrefix = keyPrefix.endsWith(".") ? keyPrefix : keyPrefix + "."; this.keyPrefix = keyPrefix.endsWith(".") ? keyPrefix : keyPrefix + ".";
} else { } else {

View File

@ -39,7 +39,7 @@ public class BotEventHandler implements EventHandler {
private final ArgumentsRunner processRunner; private final ArgumentsRunner processRunner;
private final ArgumentsRunner adminRunner; private final ArgumentsRunner adminRunner;
private final static Logger log = LoggerFactory.getLogger("BotEventHandler"); private final static Logger log = LoggerFactory.getLogger(BotEventHandler.class.getName());
/** /**
* 所有缓存共用的JedisPool * 所有缓存共用的JedisPool

View File

@ -18,7 +18,7 @@ public class CQPluginMain extends CQPlugin implements EventHandler {
public CQPluginMain() { public CQPluginMain() {
// TODO(LamGC, 2020.04.21): SpringCQ无法适配MessageSenderBuilder // TODO(LamGC, 2020.04.21): SpringCQ无法适配MessageSenderBuilder
BotEventHandler.preLoad(); BotEventHandler.preLoad();
LoggerFactory.getLogger(this.toString()) LoggerFactory.getLogger(CQPluginMain.class.getName())
.info("BotEventHandler.COMMAND_PREFIX = {}", BotEventHandler.COMMAND_PREFIX); .info("BotEventHandler.COMMAND_PREFIX = {}", BotEventHandler.COMMAND_PREFIX);
} }

View File

@ -19,7 +19,7 @@ import java.util.Properties;
public class MiraiMain implements Closeable { public class MiraiMain implements Closeable {
private final Logger log = LoggerFactory.getLogger(this.toString()); private final Logger log = LoggerFactory.getLogger(MiraiMain.class.getName());
private Bot bot; private Bot bot;

View File

@ -29,7 +29,7 @@ public class MiraiMessageSender implements MessageSender {
private final Contact member; private final Contact member;
private final MessageSource source; private final MessageSource source;
private final static Logger log = LoggerFactory.getLogger("MiraiMessageSender"); private final static Logger log = LoggerFactory.getLogger(MiraiMessageSender.class.getName());
private final static CacheStore<String> imageIdCache = new HotDataCacheStore<>( private final static CacheStore<String> imageIdCache = new HotDataCacheStore<>(
new StringRedisCacheStore(BotEventHandler.redisServer, "mirai.imageId"), new StringRedisCacheStore(BotEventHandler.redisServer, "mirai.imageId"),
new LocalHashCacheStore<>(), new LocalHashCacheStore<>(),

View File

@ -33,7 +33,7 @@ import java.util.function.BiConsumer;
public class PixivDownload { public class PixivDownload {
private final static Logger log = LoggerFactory.getLogger("PixivDownload"); private final static Logger log = LoggerFactory.getLogger(PixivDownload.class.getName());
private final HttpClient httpClient; private final HttpClient httpClient;

View File

@ -30,7 +30,7 @@ import java.util.zip.ZipInputStream;
*/ */
public final class PixivUgoiraBuilder { public final class PixivUgoiraBuilder {
private final Logger log = LoggerFactory.getLogger(PixivUgoiraBuilder.class.getSimpleName() + "@" + Integer.toHexString(this.hashCode())); private final Logger log = LoggerFactory.getLogger(this.toString());
private final HttpClient httpClient; private final HttpClient httpClient;
private final JsonObject ugoiraMeta; private final JsonObject ugoiraMeta;

View File

@ -27,7 +27,7 @@ import java.util.List;
*/ */
public class PixivAccessProxyServer { public class PixivAccessProxyServer {
private final Logger log = LoggerFactory.getLogger(this.getClass().getSimpleName()); private final Logger log = LoggerFactory.getLogger(PixivAccessProxyServer.class.getName());
private final HttpProxyServer proxyServer; private final HttpProxyServer proxyServer;

View File

@ -31,7 +31,7 @@ public class PixivDownloadTest {
private static CookieStore cookieStore; private static CookieStore cookieStore;
private final static Logger log = LoggerFactory.getLogger("PixivDownloadTest"); private final static Logger log = LoggerFactory.getLogger(PixivDownloadTest.class.getName());
private static HttpHost proxy = new HttpHost("127.0.0.1", 1001); private static HttpHost proxy = new HttpHost("127.0.0.1", 1001);
@ -180,9 +180,8 @@ public class PixivDownloadTest {
log.info("正在调用方法..."); log.info("正在调用方法...");
try { try {
pixivDownload.getRankingAsInputStream(null, null, queryDate, 5, 50, PixivDownload.PageQuality.ORIGINAL, (rank, link, rankInfo, inputStream) -> { pixivDownload.getRankingAsInputStream(null, null, queryDate, 5, 50,
log.info("空操作"); PixivDownload.PageQuality.ORIGINAL, (rank, link, rankInfo, inputStream) -> log.info("空操作"));
});
} finally { } finally {
zos.finish(); zos.finish();
zos.flush(); zos.flush();