Commit c0eac853 authored by Liang Ding's avatar Liang Ding

🎨 #44

parent 67c4a64a
<?xml version="1.0" encoding="UTF-8"?>
<!--
Description: Solo POM.
Version: 3.18.3.80, Jan 14, 2020
Version: 3.18.3.81, Jan 16, 2020
Author: <a href="http://88250.b3log.org">Liang Ding</a>
Author: <a href="http://www.annpeter.cn">Ann Peter</a>
Author: <a href="http://vanessa.b3log.org">Vanessa</a>
......@@ -73,9 +73,8 @@
</scm>
<properties>
<org.b3log.latke.version>3.1.1</org.b3log.latke.version>
<org.b3log.latke.version>3.1.3</org.b3log.latke.version>
<slf4j.version>1.7.28</slf4j.version>
<jsoup.version>1.12.1</jsoup.version>
<flexmark.version>0.50.40</flexmark.version>
<commons-cli.version>1.3.1</commons-cli.version>
......@@ -91,7 +90,6 @@
<coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.2</jacoco-maven-plugin.version>
<testng.version>6.1.1</testng.version>
<mysql-connector-java.version>8.0.18</mysql-connector-java.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
......@@ -111,12 +109,6 @@
</exclusions>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
<dependency>
<groupId>org.b3log</groupId>
<artifactId>latke-repository-mysql</artifactId>
......@@ -142,12 +134,6 @@
<version>${jsoup.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark-all</artifactId>
......
......@@ -19,13 +19,14 @@ package org.b3log.solo;
import org.apache.commons.cli.*;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Latkes;
import org.b3log.latke.event.EventManager;
import org.b3log.latke.http.BaseServer;
import org.b3log.latke.http.Dispatcher;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.plugin.PluginManager;
import org.b3log.latke.plugin.ViewLoadEventHandler;
import org.b3log.latke.repository.Transaction;
......@@ -54,7 +55,7 @@ public final class Server extends BaseServer {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(Server.class);
private static final Logger LOGGER = LogManager.getLogger(Server.class);
/**
* Solo version.
......@@ -271,7 +272,7 @@ public final class Server extends BaseServer {
}));
Stopwatchs.end();
LOGGER.log(Level.DEBUG, "Stopwatch: {0}{1}", Strings.LINE_SEPARATOR, Stopwatchs.getTimingStat());
LOGGER.log(Level.DEBUG, "Stopwatch: {}{}", Strings.LINE_SEPARATOR, Stopwatchs.getTimingStat());
Stopwatchs.release();
server.start(Integer.parseInt(portArg));
......@@ -428,7 +429,6 @@ public final class Server extends BaseServer {
Dispatcher.post("/console/plugin/updateSetting", pluginConsole::updateSetting);
final PreferenceConsole preferenceConsole = beanManager.getReference(PreferenceConsole.class);
Dispatcher.get("/console/signs/", preferenceConsole::getSigns);
Dispatcher.get("/console/preference/", preferenceConsole::getPreference);
......
......@@ -20,14 +20,15 @@ package org.b3log.solo.event;
import jodd.http.HttpRequest;
import jodd.http.HttpResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.event.AbstractEventListener;
import org.b3log.latke.event.Event;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.User;
import org.b3log.solo.Server;
import org.b3log.solo.model.Article;
......@@ -56,12 +57,12 @@ public class B3ArticleSender extends AbstractEventListener<JSONObject> {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(B3ArticleSender.class);
private static final Logger LOGGER = LogManager.getLogger(B3ArticleSender.class);
@Override
public void action(final Event<JSONObject> event) {
final JSONObject data = event.getData();
LOGGER.log(Level.DEBUG, "Processing an event [type={0}, data={1}] in listener [className={2}]",
LOGGER.log(Level.DEBUG, "Processing an event [type={}, data={}] in listener [className={}]",
event.getType(), data, B3ArticleSender.class.getName());
pushArticleToRhy(data);
......@@ -77,19 +78,19 @@ public class B3ArticleSender extends AbstractEventListener<JSONObject> {
final JSONObject originalArticle = data.getJSONObject(Article.ARTICLE);
final String title = originalArticle.getString(Article.ARTICLE_TITLE);
if (Article.ARTICLE_STATUS_C_PUBLISHED != originalArticle.optInt(Article.ARTICLE_STATUS)) {
LOGGER.log(Level.INFO, "Ignored push a draft [title={0}] to Rhy", title);
LOGGER.log(Level.INFO, "Ignored push a draft [title={}] to Rhy", title);
return;
}
if (StringUtils.isNotBlank(originalArticle.optString(Article.ARTICLE_VIEW_PWD))) {
LOGGER.log(Level.INFO, "Article [title={0}] is a password article, ignored push to Rhy", title);
LOGGER.log(Level.INFO, "Article [title={}] is a password article, ignored push to Rhy", title);
return;
}
if (!originalArticle.optBoolean(Common.POST_TO_COMMUNITY)) {
LOGGER.log(Level.INFO, "Article [title={0}] push flag [postToCommunity] is [false], ignored push to Rhy", title);
LOGGER.log(Level.INFO, "Article [title={}] push flag [postToCommunity] is [false], ignored push to Rhy", title);
return;
}
......
......@@ -17,11 +17,12 @@
*/
package org.b3log.solo.event;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.event.AbstractEventListener;
import org.b3log.latke.event.Event;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.json.JSONObject;
/**
......@@ -40,11 +41,11 @@ public class B3ArticleUpdater extends AbstractEventListener<JSONObject> {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(B3ArticleUpdater.class);
private static final Logger LOGGER = LogManager.getLogger(B3ArticleUpdater.class);
public void action(final Event<JSONObject> event) {
final JSONObject data = event.getData();
LOGGER.log(Level.DEBUG, "Processing an event [type={0}, data={1}] in listener [className={2}]",
LOGGER.log(Level.DEBUG, "Processing an event [type={}, data={}] in listener [className={}]",
event.getType(), data, B3ArticleUpdater.class.getName());
B3ArticleSender.pushArticleToRhy(data);
......
......@@ -18,14 +18,15 @@
package org.b3log.solo.event;
import jodd.http.HttpRequest;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.event.AbstractEventListener;
import org.b3log.latke.event.Event;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.User;
import org.b3log.solo.Server;
import org.b3log.solo.model.Article;
......@@ -51,7 +52,7 @@ public class B3CommentSender extends AbstractEventListener<JSONObject> {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(B3CommentSender.class);
private static final Logger LOGGER = LogManager.getLogger(B3CommentSender.class);
/**
* Option query service.
......@@ -75,7 +76,7 @@ public class B3CommentSender extends AbstractEventListener<JSONObject> {
public void action(final Event<JSONObject> event) {
final JSONObject data = event.getData();
LOGGER.log(Level.DEBUG, "Processing an event [type={0}, data={1}] in listener [className={2}]",
LOGGER.log(Level.DEBUG, "Processing an event [type={}, data={}] in listener [className={}]",
event.getType(), data, B3ArticleSender.class.getName());
try {
final JSONObject originalComment = data.getJSONObject(Comment.COMMENT);
......
......@@ -17,12 +17,13 @@
*/
package org.b3log.solo.event;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.event.AbstractEventListener;
import org.b3log.latke.event.Event;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.plugin.AbstractPlugin;
import org.b3log.latke.plugin.PluginManager;
import org.b3log.latke.repository.Transaction;
......@@ -44,13 +45,13 @@ public class PluginRefresher extends AbstractEventListener<List<AbstractPlugin>>
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(PluginRefresher.class);
private static final Logger LOGGER = LogManager.getLogger(PluginRefresher.class);
@Override
public void action(final Event<List<AbstractPlugin>> event) {
final List<AbstractPlugin> plugins = event.getData();
LOGGER.log(Level.DEBUG, "Processing an event [type={0}, data={1}] in listener [className={2}]",
LOGGER.log(Level.DEBUG, "Processing an event [type={}, data={}] in listener [className={}]",
event.getType(), plugins, PluginRefresher.class.getName());
final BeanManager beanManager = BeanManager.getInstance();
......
......@@ -19,9 +19,7 @@ package org.b3log.solo.model.atom;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.util.XMLs;
import org.b3log.solo.processor.FeedProcessor;
import java.util.ArrayList;
import java.util.Date;
......@@ -47,11 +45,6 @@ public final class Feed {
*/
public static final String TIME_ZONE_ID = "Asia/Shanghai";
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(FeedProcessor.class);
/**
* Link variable.
*/
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.processor;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.handler.Handler;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.jdbc.JdbcRepository;
import org.b3log.latke.util.Stopwatchs;
import org.b3log.latke.util.Strings;
......@@ -34,14 +35,14 @@ import org.b3log.latke.util.Strings;
*/
public class AfterRequestHandler implements Handler {
private static final Logger LOGGER = Logger.getLogger(AfterRequestHandler.class);
private static final Logger LOGGER = LogManager.getLogger(AfterRequestHandler.class);
@Override
public void handle(final RequestContext context) {
JdbcRepository.dispose();
Stopwatchs.end();
LOGGER.log(Level.TRACE, "Stopwatch: {0}{1}", Strings.LINE_SEPARATOR, Stopwatchs.getTimingStat());
LOGGER.log(Level.TRACE, "Stopwatch: {}{}", Strings.LINE_SEPARATOR, Stopwatchs.getTimingStat());
Stopwatchs.release();
}
}
......@@ -19,6 +19,9 @@ package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.event.Event;
......@@ -30,8 +33,6 @@ import org.b3log.latke.http.renderer.AbstractFreeMarkerRenderer;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.http.renderer.TextHtmlRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.model.User;
import org.b3log.latke.service.LangPropsService;
......@@ -64,7 +65,7 @@ public class ArticleProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ArticleProcessor.class);
private static final Logger LOGGER = LogManager.getLogger(ArticleProcessor.class);
/**
* Article query service.
......@@ -585,7 +586,7 @@ public class ArticleProcessor {
try {
final String authorId = context.pathVar("author");
final int currentPageNum = Paginator.getPage(request);
LOGGER.log(Level.DEBUG, "Request author articles [authorId={0}, currentPageNum={1}]", authorId, currentPageNum);
LOGGER.log(Level.DEBUG, "Request author articles [authorId={}, currentPageNum={}]", authorId, currentPageNum);
final JSONObject preference = optionQueryService.getPreference();
if (null == preference) {
......@@ -646,10 +647,10 @@ public class ArticleProcessor {
try {
final int currentPageNum = Paginator.getPage(request);
final String archiveDateString = context.pathVar("yyyy") + "/" + context.pathVar("MM");
LOGGER.log(Level.DEBUG, "Request archive date [string={0}, currentPageNum={1}]", archiveDateString, currentPageNum);
LOGGER.log(Level.DEBUG, "Request archive date [string={}, currentPageNum={}]", archiveDateString, currentPageNum);
final JSONObject result = archiveDateQueryService.getByArchiveDateString(archiveDateString);
if (null == result) {
LOGGER.log(Level.DEBUG, "Can not find articles for the specified archive date[string={0}]", archiveDateString);
LOGGER.log(Level.DEBUG, "Can not find articles for the specified archive date[string={}]", archiveDateString);
context.sendError(404);
return;
......@@ -704,12 +705,12 @@ public class ArticleProcessor {
}
final String articleId = article.optString(Keys.OBJECT_ID);
LOGGER.log(Level.DEBUG, "Article [id={0}]", articleId);
LOGGER.log(Level.DEBUG, "Article [id={}]", articleId);
final AbstractFreeMarkerRenderer renderer = new SkinRenderer(context, "article.ftl");
try {
LOGGER.log(Level.TRACE, "Article [title={0}]", article.getString(Article.ARTICLE_TITLE));
LOGGER.log(Level.TRACE, "Article [title={}]", article.getString(Article.ARTICLE_TITLE));
articleQueryService.markdown(article);
article.put(Article.ARTICLE_T_CREATE_DATE, new Date(article.optLong(Article.ARTICLE_CREATED)));
......
......@@ -18,14 +18,15 @@
package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.HttpMethod;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.RequestProcessing;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Role;
import org.b3log.latke.model.User;
import org.b3log.latke.repository.Transaction;
......@@ -56,7 +57,7 @@ public class B3Receiver {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(B3Receiver.class);
private static final Logger LOGGER = LogManager.getLogger(B3Receiver.class);
/**
* User repository.
......
......@@ -19,6 +19,9 @@ package org.b3log.solo.processor;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.HttpMethod;
......@@ -27,8 +30,6 @@ import org.b3log.latke.http.annotation.RequestProcessing;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.model.User;
import org.b3log.solo.Server;
......@@ -39,6 +40,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
/**
* Blog processor.
......@@ -53,7 +55,7 @@ public class BlogProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(BlogProcessor.class);
private static final Logger LOGGER = LogManager.getLogger(BlogProcessor.class);
/**
* Article query service.
......@@ -92,7 +94,7 @@ public class BlogProcessor {
static {
try (final InputStream tplStream = BlogProcessor.class.getResourceAsStream("/manifest.json.tpl")) {
PWA_MANIFESTO_JSON = IOUtils.toString(tplStream, "UTF-8");
PWA_MANIFESTO_JSON = IOUtils.toString(tplStream, StandardCharsets.UTF_8);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Loads PWA manifest.json template failed", e);
}
......
......@@ -17,6 +17,9 @@
*/
package org.b3log.solo.processor;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.HttpMethod;
import org.b3log.latke.http.RequestContext;
......@@ -26,8 +29,6 @@ import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.AbstractFreeMarkerRenderer;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
......@@ -59,7 +60,7 @@ public class CategoryProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(CategoryProcessor.class);
private static final Logger LOGGER = LogManager.getLogger(CategoryProcessor.class);
/**
* DataModelService.
......@@ -167,7 +168,7 @@ public class CategoryProcessor {
String categoryURI = context.pathVar("categoryURI");
categoryURI = URLs.encode(categoryURI);
final int currentPageNum = Paginator.getPage(context);
LOGGER.log(Level.DEBUG, "Category [URI={0}, currentPageNum={1}]", categoryURI, currentPageNum);
LOGGER.log(Level.DEBUG, "Category [URI={}, currentPageNum={}]", categoryURI, currentPageNum);
final JSONObject category = categoryQueryService.getByURI(categoryURI);
if (null == category) {
context.sendError(404);
......
......@@ -18,6 +18,9 @@
package org.b3log.solo.processor;
import freemarker.template.Template;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.HttpMethod;
import org.b3log.latke.http.RequestContext;
......@@ -25,8 +28,6 @@ import org.b3log.latke.http.annotation.RequestProcessing;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.User;
import org.b3log.latke.service.LangPropsService;
import org.b3log.solo.model.Article;
......@@ -59,7 +60,7 @@ public class CommentProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(CommentProcessor.class);
private static final Logger LOGGER = LogManager.getLogger(CommentProcessor.class);
/**
* Language service.
......@@ -137,7 +138,7 @@ public class CommentProcessor {
renderer.setJSONObject(jsonObject);
if (!jsonObject.optBoolean(Keys.STATUS_CODE)) {
LOGGER.log(Level.WARN, "Can't add comment[msg={0}]", jsonObject.optString(Keys.MSG));
LOGGER.log(Level.WARN, "Can't add comment[msg={}]", jsonObject.optString(Keys.MSG));
return;
}
......
......@@ -18,14 +18,15 @@
package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.Request;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.renderer.AbstractFreeMarkerRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.util.Locales;
import org.b3log.solo.model.Common;
......@@ -50,7 +51,7 @@ public class ErrorProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ArticleProcessor.class);
private static final Logger LOGGER = LogManager.getLogger(ArticleProcessor.class);
/**
* DataModelService.
......@@ -88,7 +89,7 @@ public class ErrorProcessor {
if (StringUtils.equals("GET", context.method())) {
final String requestURI = context.requestURI();
final String templateName = statusCode + ".ftl";
LOGGER.log(Level.TRACE, "Shows error page [requestURI={0}, templateName={1}]", requestURI, templateName);
LOGGER.log(Level.TRACE, "Shows error page [requestURI={}, templateName={}]", requestURI, templateName);
final AbstractFreeMarkerRenderer renderer = new SkinRenderer(context, "error/" + templateName);
final Map<String, Object> dataModel = renderer.getDataModel();
......
......@@ -18,6 +18,9 @@
package org.b3log.solo.processor;
import com.vdurmont.emoji.EmojiParser;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.HttpMethod;
......@@ -27,8 +30,6 @@ import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.AtomRenderer;
import org.b3log.latke.http.renderer.RssRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.User;
import org.b3log.latke.repository.*;
import org.b3log.latke.service.ServiceException;
......@@ -68,7 +69,7 @@ public class FeedProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(FeedProcessor.class);
private static final Logger LOGGER = LogManager.getLogger(FeedProcessor.class);
/**
* Article query service.
......
......@@ -18,6 +18,9 @@
package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.*;
......@@ -25,8 +28,6 @@ import org.b3log.latke.http.annotation.RequestProcessing;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.AbstractFreeMarkerRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
......@@ -62,7 +63,7 @@ public class IndexProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(IndexProcessor.class);
private static final Logger LOGGER = LogManager.getLogger(IndexProcessor.class);
/**
* DataModelService.
......
......@@ -18,13 +18,14 @@
package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.handler.Handler;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.solo.service.InitService;
/**
......@@ -39,7 +40,7 @@ public class InitCheckHandler implements Handler {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(InitCheckHandler.class);
private static final Logger LOGGER = LogManager.getLogger(InitCheckHandler.class);
/**
* Whether initialization info reported.
......@@ -50,7 +51,7 @@ public class InitCheckHandler implements Handler {
public void handle(final RequestContext context) {
final String requestURI = context.requestURI();
final boolean isSpiderBot = (boolean) context.attr(Keys.HttpRequest.IS_SEARCH_ENGINE_BOT);
LOGGER.log(Level.TRACE, "Request [URI={0}]", requestURI);
LOGGER.log(Level.TRACE, "Request [URI={}]", requestURI);
// 禁止直接获取 robots.txt https://github.com/b3log/solo/issues/12543
if (requestURI.startsWith("/robots.txt") && !isSpiderBot) {
......
......@@ -19,6 +19,9 @@ package org.b3log.solo.processor;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.HttpMethod;
import org.b3log.latke.http.Request;
......@@ -27,8 +30,6 @@ import org.b3log.latke.http.Response;
import org.b3log.latke.http.annotation.RequestProcessing;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Role;
import org.b3log.latke.model.User;
import org.b3log.latke.service.LangPropsService;
......@@ -59,7 +60,7 @@ public class OAuthProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(OAuthProcessor.class);
private static final Logger LOGGER = LogManager.getLogger(OAuthProcessor.class);
/**
* OAuth parameters - state.
......@@ -207,6 +208,6 @@ public class OAuthProcessor {
Solos.login(user, response);
context.sendRedirect(referer);
LOGGER.log(Level.INFO, "Logged in [name={0}, remoteAddr={1}] with oauth", userName, Requests.getRemoteAddr(request));
LOGGER.log(Level.INFO, "Logged in [name={}, remoteAddr={}] with oauth", userName, Requests.getRemoteAddr(request));
}
}
......@@ -18,14 +18,15 @@
package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.HttpMethod;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.handler.Handler;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.solo.model.Article;
import org.b3log.solo.model.Option;
......@@ -48,7 +49,7 @@ public class PermalinkHandler implements Handler {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(PermalinkHandler.class);
private static final Logger LOGGER = LogManager.getLogger(PermalinkHandler.class);
/**
* Whether initialization info reported.
......@@ -72,7 +73,7 @@ public class PermalinkHandler implements Handler {
final String contextPath = Latkes.getContextPath();
final String permalink = StringUtils.substringAfter(requestURI, contextPath);
if (PermalinkQueryService.invalidPermalinkFormat(permalink)) {
LOGGER.log(Level.DEBUG, "Skip permalink handling request [URI={0}]", permalink);
LOGGER.log(Level.DEBUG, "Skip permalink handling request [URI={}]", permalink);
context.handle();
return;
......@@ -81,7 +82,7 @@ public class PermalinkHandler implements Handler {
final ArticleRepository articleRepository = beanManager.getReference(ArticleRepository.class);
article = articleRepository.getByPermalink(permalink);
if (null == article) {
LOGGER.log(Level.DEBUG, "Not found article with permalink [{0}]", permalink);
LOGGER.log(Level.DEBUG, "Not found article with permalink [{}]", permalink);
context.handle();
return;
......
......@@ -19,6 +19,9 @@ package org.b3log.solo.processor;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.HttpMethod;
import org.b3log.latke.http.Request;
......@@ -28,8 +31,6 @@ import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.AbstractFreeMarkerRenderer;
import org.b3log.latke.http.renderer.TextXmlRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.util.Paginator;
......@@ -46,6 +47,7 @@ import org.jsoup.safety.Whitelist;
import org.owasp.encoder.Encode;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.Map;
......@@ -64,7 +66,7 @@ public class SearchProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(SearchProcessor.class);
private static final Logger LOGGER = LogManager.getLogger(SearchProcessor.class);
/**
* Article query service.
......@@ -108,7 +110,7 @@ public class SearchProcessor {
try {
final InputStream resourceAsStream = SearchProcessor.class.getResourceAsStream("/opensearch.xml");
String content = IOUtils.toString(resourceAsStream, "UTF-8");
String content = IOUtils.toString(resourceAsStream, StandardCharsets.UTF_8);
final JSONObject preference = optionQueryService.getPreference();
content = StringUtils.replace(content, "${blogTitle}", Jsoup.clean(preference.optString(Option.ID_C_BLOG_TITLE), Whitelist.none()));
content = StringUtils.replace(content, "${blogSubtitle}", Jsoup.clean(preference.optString(Option.ID_C_BLOG_SUBTITLE), Whitelist.none()));
......
......@@ -19,6 +19,9 @@ package org.b3log.solo.processor;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.HttpMethod;
......@@ -27,8 +30,6 @@ import org.b3log.latke.http.annotation.RequestProcessing;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.TextXmlRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.FilterOperator;
import org.b3log.latke.repository.PropertyFilter;
import org.b3log.latke.repository.Query;
......@@ -61,7 +62,7 @@ public class SitemapProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(SitemapProcessor.class);
private static final Logger LOGGER = LogManager.getLogger(SitemapProcessor.class);
/**
* Article repository.
......
......@@ -20,13 +20,14 @@ package org.b3log.solo.processor;
import eu.bitwalker.useragentutils.BrowserType;
import eu.bitwalker.useragentutils.UserAgent;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.Request;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.handler.Handler;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.util.Requests;
import org.b3log.solo.service.OptionQueryService;
import org.b3log.solo.service.StatisticMgmtService;
......@@ -46,7 +47,7 @@ public class SkinHandler implements Handler {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(SkinHandler.class);
private static final Logger LOGGER = LogManager.getLogger(SkinHandler.class);
@Override
public void handle(final RequestContext context) {
......
......@@ -17,6 +17,9 @@
*/
package org.b3log.solo.processor;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.HttpMethod;
import org.b3log.latke.http.RequestContext;
......@@ -24,8 +27,6 @@ import org.b3log.latke.http.annotation.RequestProcessing;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.AbstractFreeMarkerRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.util.Paginator;
......@@ -54,7 +55,7 @@ public class TagProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(TagProcessor.class);
private static final Logger LOGGER = LogManager.getLogger(TagProcessor.class);
/**
* DataModelService.
......@@ -111,7 +112,7 @@ public class TagProcessor {
try {
String tagTitle = context.pathVar("tagTitle");
final int currentPageNum = Paginator.getPage(context);
LOGGER.log(Level.DEBUG, "Tag [title={0}, currentPageNum={1}]", tagTitle, currentPageNum);
LOGGER.log(Level.DEBUG, "Tag [title={}, currentPageNum={}]", tagTitle, currentPageNum);
final JSONObject result = tagQueryService.getTagByTitle(tagTitle);
if (null == result) {
context.sendError(404);
......
......@@ -19,6 +19,9 @@ package org.b3log.solo.processor;
import freemarker.template.Template;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.HttpMethod;
import org.b3log.latke.http.Request;
......@@ -29,8 +32,6 @@ import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.AbstractFreeMarkerRenderer;
import org.b3log.latke.http.renderer.TextHtmlRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.util.Locales;
import org.b3log.solo.model.Option;
......@@ -62,7 +63,7 @@ public class UserTemplateProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ArticleProcessor.class);
private static final Logger LOGGER = LogManager.getLogger(ArticleProcessor.class);
/**
* DataModelService.
......@@ -112,7 +113,7 @@ public class UserTemplateProcessor {
return;
}
LOGGER.log(Level.DEBUG, "Shows page [requestURI={0}, templateName={1}]", requestURI, templateName);
LOGGER.log(Level.DEBUG, "Shows page [requestURI={}, templateName={}]", requestURI, templateName);
final Request request = context.getRequest();
final Response response = context.getResponse();
......
......@@ -21,6 +21,9 @@ import jodd.io.ZipUtil;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.event.Event;
......@@ -31,8 +34,6 @@ import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.renderer.AbstractFreeMarkerRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Plugin;
import org.b3log.latke.model.User;
import org.b3log.latke.plugin.ViewLoadEventData;
......@@ -53,6 +54,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.*;
/**
......@@ -69,7 +71,7 @@ public class AdminConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(AdminConsole.class);
private static final Logger LOGGER = LogManager.getLogger(AdminConsole.class);
/**
* Language service.
......@@ -280,7 +282,7 @@ public class AdminConsole {
try {
final JSONObject json = exportService.getJSONs();
final byte[] data = json.toString(4).getBytes("UTF-8");
final byte[] data = json.toString(4).getBytes(StandardCharsets.UTF_8);
try (final OutputStream output = new FileOutputStream(localFile)) {
IOUtils.write(data, output);
......
......@@ -19,6 +19,9 @@ package org.b3log.solo.processor.console;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.Request;
......@@ -27,8 +30,6 @@ import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.util.Strings;
......@@ -59,7 +60,7 @@ public class ArticleConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ArticleConsole.class);
private static final Logger LOGGER = LogManager.getLogger(ArticleConsole.class);
/**
* Article management service.
......
......@@ -19,6 +19,9 @@ package org.b3log.solo.processor.console;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
......@@ -26,8 +29,6 @@ import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.util.URLs;
......@@ -61,7 +62,7 @@ public class CategoryConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(CategoryConsole.class);
private static final Logger LOGGER = LogManager.getLogger(CategoryConsole.class);
/**
* Category management service.
......
......@@ -17,6 +17,9 @@
*/
package org.b3log.solo.processor.console;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
......@@ -24,8 +27,6 @@ import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.solo.model.Comment;
import org.b3log.solo.service.CommentMgmtService;
......@@ -49,7 +50,7 @@ public class CommentConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(CommentConsole.class);
private static final Logger LOGGER = LogManager.getLogger(CommentConsole.class);
/**
* Comment query service.
......
......@@ -18,6 +18,9 @@
package org.b3log.solo.processor.console;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
......@@ -25,8 +28,6 @@ import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.solo.model.Common;
import org.b3log.solo.model.Link;
......@@ -50,7 +51,7 @@ public class LinkConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(LinkConsole.class);
private static final Logger LOGGER = LogManager.getLogger(LinkConsole.class);
/**
* Link query service.
......
......@@ -17,14 +17,15 @@
*/
package org.b3log.solo.processor.console;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.solo.service.ArchiveDateMgmtService;
import org.b3log.solo.service.TagMgmtService;
......@@ -43,7 +44,7 @@ public class OtherConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(OtherConsole.class);
private static final Logger LOGGER = LogManager.getLogger(OtherConsole.class);
/**
* Tag management service.
......
......@@ -18,6 +18,9 @@
package org.b3log.solo.processor.console;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
......@@ -25,8 +28,6 @@ import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.solo.model.Common;
......@@ -52,7 +53,7 @@ public class PageConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(PageConsole.class);
private static final Logger LOGGER = LogManager.getLogger(PageConsole.class);
/**
* User query service.
......
......@@ -17,6 +17,9 @@
*/
package org.b3log.solo.processor.console;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
......@@ -24,8 +27,6 @@ import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Plugin;
import org.b3log.latke.service.LangPropsService;
import org.b3log.solo.service.PluginMgmtService;
......@@ -50,7 +51,7 @@ public class PluginConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(PluginConsole.class);
private static final Logger LOGGER = LogManager.getLogger(PluginConsole.class);
/**
* Plugin query service.
......
......@@ -17,14 +17,15 @@
*/
package org.b3log.solo.processor.console;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.solo.model.Option;
......@@ -50,7 +51,7 @@ public class PreferenceConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(PreferenceConsole.class);
private static final Logger LOGGER = LogManager.getLogger(PreferenceConsole.class);
/**
* Preference management service.
......
......@@ -17,14 +17,15 @@
*/
package org.b3log.solo.processor.console;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.TextHtmlRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.*;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.ArchiveDateArticleRepository;
......@@ -53,7 +54,7 @@ public class RepairConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(RepairConsole.class);
private static final Logger LOGGER = LogManager.getLogger(RepairConsole.class);
/**
* Option query service.
......
......@@ -17,6 +17,9 @@
*/
package org.b3log.solo.processor.console;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.Cookie;
......@@ -26,8 +29,6 @@ import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.solo.model.Common;
......@@ -54,7 +55,7 @@ public class SkinConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(SkinConsole.class);
private static final Logger LOGGER = LogManager.getLogger(SkinConsole.class);
/**
* Skin management service.
......@@ -112,7 +113,7 @@ public class SkinConsole {
final JSONObject s = new JSONObject();
final String name = Latkes.getSkinName(dirName);
if (null == name) {
LOGGER.log(Level.WARN, "The directory [{0}] does not contain any skin, ignored it", dirName);
LOGGER.log(Level.WARN, "The directory [{}] does not contain any skin, ignored it", dirName);
continue;
}
......
......@@ -21,6 +21,9 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.HttpMethod;
import org.b3log.latke.http.RequestContext;
......@@ -29,8 +32,6 @@ import org.b3log.latke.http.annotation.RequestProcessing;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.util.CollectionUtils;
import org.b3log.latke.util.Strings;
......@@ -61,7 +62,7 @@ public class StaticSiteConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(StaticSiteConsole.class);
private static final Logger LOGGER = LogManager.getLogger(StaticSiteConsole.class);
/**
* Language service.
......
......@@ -17,14 +17,15 @@
*/
package org.b3log.solo.processor.console;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.solo.model.Common;
import org.b3log.solo.model.Tag;
import org.b3log.solo.service.TagQueryService;
......@@ -46,7 +47,7 @@ public class TagConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(TagConsole.class);
private static final Logger LOGGER = LogManager.getLogger(TagConsole.class);
/**
* Tag query service.
......
......@@ -18,6 +18,9 @@
package org.b3log.solo.processor.console;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
......@@ -25,8 +28,6 @@ import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.User;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
......@@ -50,7 +51,7 @@ public class UserConsole {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(UserConsole.class);
private static final Logger LOGGER = LogManager.getLogger(UserConsole.class);
/**
* User query service.
......
......@@ -2,3 +2,4 @@
* Console requests (Articles, Comments, Preference, etc, management) processing.
*/
package org.b3log.solo.processor.console;
......@@ -2,3 +2,4 @@
* HTTP request processing.
*/
package org.b3log.solo.processor;
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.repository;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.*;
import org.b3log.latke.repository.annotation.Repository;
import org.b3log.solo.model.ArchiveDate;
......@@ -43,7 +44,7 @@ public class ArchiveDateArticleRepository extends AbstractRepository {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ArchiveDateArticleRepository.class);
private static final Logger LOGGER = LogManager.getLogger(ArchiveDateArticleRepository.class);
/**
* Public constructor.
......
......@@ -18,10 +18,11 @@
package org.b3log.solo.repository;
import org.apache.commons.lang.time.DateUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.*;
import org.b3log.latke.repository.annotation.Repository;
import org.b3log.solo.model.ArchiveDate;
......@@ -44,7 +45,7 @@ public class ArchiveDateRepository extends AbstractRepository {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ArchiveDateRepository.class);
private static final Logger LOGGER = LogManager.getLogger(ArchiveDateRepository.class);
/**
* Archive date-Article repository.
......@@ -74,7 +75,7 @@ public class ArchiveDateRepository extends AbstractRepository {
return null;
}
LOGGER.log(Level.TRACE, "Archive date [{0}] parsed to time [{1}]", archiveDate, time);
LOGGER.log(Level.TRACE, "Archive date [{}] parsed to time [{}]", archiveDate, time);
Query query = new Query().setFilter(new PropertyFilter(ArchiveDate.ARCHIVE_TIME, FilterOperator.EQUAL, time)).setPageCount(1);
JSONObject result = get(query);
......@@ -88,7 +89,7 @@ public class ArchiveDateRepository extends AbstractRepository {
return null;
}
LOGGER.log(Level.TRACE, "Fix archive date [{0}] parsed to time [{1}]", archiveDate, time);
LOGGER.log(Level.TRACE, "Fix archive date [{}] parsed to time [{}]", archiveDate, time);
query = new Query().setFilter(new PropertyFilter(ArchiveDate.ARCHIVE_TIME, FilterOperator.EQUAL, time)).setPageCount(1);
result = get(query);
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.repository;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.*;
import org.b3log.latke.repository.annotation.Repository;
import org.b3log.solo.cache.ArticleCache;
......@@ -45,7 +46,7 @@ public class ArticleRepository extends AbstractRepository {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ArticleRepository.class);
private static final Logger LOGGER = LogManager.getLogger(ArticleRepository.class);
/**
* Random range.
......@@ -107,7 +108,7 @@ public class ArticleRepository extends AbstractRepository {
final double mid = Math.random() + RANDOM_RANGE;
LOGGER.log(Level.TRACE, "Random mid[{0}]", mid);
LOGGER.log(Level.TRACE, "Random mid[{}]", mid);
Query query = new Query().setFilter(CompositeFilterOperator.and(
new PropertyFilter(Article.ARTICLE_RANDOM_DOUBLE, FilterOperator.GREATER_THAN_OR_EQUAL, mid),
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.repository;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.*;
import org.b3log.latke.repository.annotation.Repository;
import org.b3log.solo.cache.CommentCache;
......@@ -43,7 +44,7 @@ public class CommentRepository extends AbstractRepository {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(CommentRepository.class);
private static final Logger LOGGER = LogManager.getLogger(CommentRepository.class);
/**
* Article repository.
......@@ -147,7 +148,7 @@ public class CommentRepository extends AbstractRepository {
remove(commentId);
}
LOGGER.log(Level.DEBUG, "Removed comments[onId={0}, removedCnt={1}]", onId, comments.size());
LOGGER.log(Level.DEBUG, "Removed comments[onId={}, removedCnt={}]", onId, comments.size());
return comments.size();
}
......
......@@ -18,11 +18,12 @@
package org.b3log.solo.repository;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.*;
import org.b3log.latke.repository.annotation.Repository;
import org.b3log.solo.model.Article;
......@@ -45,7 +46,7 @@ public class TagArticleRepository extends AbstractRepository {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(TagArticleRepository.class);
private static final Logger LOGGER = LogManager.getLogger(TagArticleRepository.class);
/**
* Public constructor.
......
......@@ -2,3 +2,4 @@
* Data access.
*/
package org.b3log.solo.repository;
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.service.annotation.Service;
......@@ -44,7 +45,7 @@ public class ArchiveDateMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ArchiveDateMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(ArchiveDateMgmtService.class);
/**
* Archive date repository.
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service;
......@@ -44,7 +45,7 @@ public class ArchiveDateQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ArchiveDateQueryService.class);
private static final Logger LOGGER = LogManager.getLogger(ArchiveDateQueryService.class);
/**
* Archive date repository.
......
......@@ -20,12 +20,13 @@ package org.b3log.solo.service;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.event.Event;
import org.b3log.latke.event.EventManager;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.service.LangPropsService;
......@@ -61,7 +62,7 @@ public class ArticleMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ArticleMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(ArticleMgmtService.class);
/**
* Article query service.
......@@ -390,7 +391,7 @@ public class ArticleMgmtService {
transaction.rollback();
}
LOGGER.log(Level.ERROR, "Can't put the article[oId{0}] to top", articleId);
LOGGER.log(Level.ERROR, "Can't put the article[oId{}] to top", articleId);
throw new ServiceException(e);
}
}
......@@ -774,7 +775,7 @@ public class ArticleMgmtService {
final String newTagTitle = newTag.getString(Tag.TAG_TITLE);
if (!tagExists(newTagTitle, oldTags)) {
LOGGER.log(Level.DEBUG, "Tag need to add[title={0}]", newTagTitle);
LOGGER.log(Level.DEBUG, "Tag need to add[title={}]", newTagTitle);
tagsNeedToAdd.add(newTag);
} else {
tagsUnchanged.add(newTag);
......@@ -784,14 +785,14 @@ public class ArticleMgmtService {
final String oldTagTitle = oldTag.getString(Tag.TAG_TITLE);
if (!tagExists(oldTagTitle, newTags)) {
LOGGER.log(Level.DEBUG, "Tag dropped[title={0}]", oldTag);
LOGGER.log(Level.DEBUG, "Tag dropped[title={}]", oldTag);
tagsDropped.add(oldTag);
} else {
tagsUnchanged.remove(oldTag);
}
}
LOGGER.log(Level.DEBUG, "Tags unchanged [{0}]", tagsUnchanged);
LOGGER.log(Level.DEBUG, "Tags unchanged [{}]", tagsUnchanged);
final String[] tagIdsDropped = new String[tagsDropped.size()];
for (int i = 0; i < tagIdsDropped.length; i++) {
......@@ -886,7 +887,7 @@ public class ArticleMgmtService {
String tagId;
if (null == tag) {
LOGGER.log(Level.TRACE, "Found a new tag[title={0}] in article[title={1}]",
LOGGER.log(Level.TRACE, "Found a new tag[title={}] in article[title={}]",
tagTitle, article.optString(Article.ARTICLE_TITLE));
tag = new JSONObject();
tag.put(Tag.TAG_TITLE, tagTitle);
......@@ -894,7 +895,7 @@ public class ArticleMgmtService {
tag.put(Keys.OBJECT_ID, tagId);
} else {
tagId = tag.optString(Keys.OBJECT_ID);
LOGGER.log(Level.TRACE, "Found a existing tag[title={0}, id={1}] in article[title={2}]",
LOGGER.log(Level.TRACE, "Found a existing tag[title={}, id={}] in article[title={}]",
tag.optString(Tag.TAG_TITLE), tag.optString(Keys.OBJECT_ID), article.optString(Article.ARTICLE_TITLE));
final JSONObject tagTmp = new JSONObject();
tagTmp.put(Keys.OBJECT_ID, tagId);
......
......@@ -18,12 +18,13 @@
package org.b3log.solo.service;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.model.Role;
import org.b3log.latke.model.User;
......@@ -60,7 +61,7 @@ public class ArticleQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ArticleQueryService.class);
private static final Logger LOGGER = LogManager.getLogger(ArticleQueryService.class);
/**
* User repository.
......@@ -326,7 +327,7 @@ public class ArticleQueryService {
final String userId = article.getString(Article.ARTICLE_AUTHOR_ID);
JSONObject ret = userRepository.get(userId);
if (null == ret) {
LOGGER.log(Level.WARN, "Gets author of article failed, assumes the administrator is the author of this article [id={0}]",
LOGGER.log(Level.WARN, "Gets author of article failed, assumes the administrator is the author of this article [id={}]",
article.getString(Keys.OBJECT_ID));
// This author may be deleted by admin, use admin as the author of this article
ret = userRepository.getAdmin();
......@@ -334,7 +335,7 @@ public class ArticleQueryService {
return ret;
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Gets author of article [id={0}] failed", article.optString(Keys.OBJECT_ID));
LOGGER.log(Level.ERROR, "Gets author of article [id={}] failed", article.optString(Keys.OBJECT_ID));
throw new ServiceException(e);
}
......@@ -363,7 +364,7 @@ public class ArticleQueryService {
}
}
LOGGER.log(Level.WARN, "Can not find the sign [id={0}], returns a default sign [id=1]", signId);
LOGGER.log(Level.WARN, "Can not find the sign [id={}], returns a default sign [id=1]", signId);
return defaultSign;
}
......@@ -461,7 +462,7 @@ public class ArticleQueryService {
article.remove(Article.ARTICLE_VIEW_COUNT);
article.remove(Article.ARTICLE_RANDOM_DOUBLE);
LOGGER.log(Level.DEBUG, "Got an article [id={0}]", articleId);
LOGGER.log(Level.DEBUG, "Got an article [id={}]", articleId);
return ret;
} catch (final Exception e) {
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.*;
import org.b3log.latke.repository.annotation.Transactional;
import org.b3log.latke.service.ServiceException;
......@@ -45,7 +46,7 @@ public class CategoryMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(CategoryMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(CategoryMgmtService.class);
/**
* Category repository.
......@@ -87,7 +88,7 @@ public class CategoryMgmtService {
transaction.rollback();
}
LOGGER.log(Level.WARN, "Cant not find the target category of source category [order={0}]", srcCategoryOrder);
LOGGER.log(Level.WARN, "Cant not find the target category of source category [order={}]", srcCategoryOrder);
return;
}
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.repository.*;
import org.b3log.latke.service.ServiceException;
......@@ -53,7 +54,7 @@ public class CategoryQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(CategoryQueryService.class);
private static final Logger LOGGER = LogManager.getLogger(CategoryQueryService.class);
/**
* Category repository.
......@@ -138,9 +139,6 @@ public class CategoryQueryService {
public JSONObject getByURI(final String categoryURI) throws ServiceException {
try {
final JSONObject ret = categoryRepository.getByURI(categoryURI);
if (null == ret) {
return null;
}
return ret;
} catch (final RepositoryException e) {
......
......@@ -19,12 +19,13 @@ package org.b3log.solo.service;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.event.Event;
import org.b3log.latke.event.EventManager;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.service.LangPropsService;
......@@ -56,7 +57,7 @@ public class CommentMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(CommentMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(CommentMgmtService.class);
/**
* Minimum length of comment name.
......@@ -179,7 +180,7 @@ public class CommentMgmtService {
String commentName = requestJSONObject.getString(Comment.COMMENT_NAME);
if (MAX_COMMENT_NAME_LENGTH < commentName.length() || MIN_COMMENT_NAME_LENGTH > commentName.length()) {
LOGGER.log(Level.WARN, "Comment name is too long [{0}]", commentName);
LOGGER.log(Level.WARN, "Comment name is too long [{}]", commentName);
ret.put(Keys.MSG, langPropsService.get("nameTooLongLabel"));
return ret;
......@@ -202,7 +203,7 @@ public class CommentMgmtService {
String commentContent = requestJSONObject.optString(Comment.COMMENT_CONTENT);
if (MAX_COMMENT_CONTENT_LENGTH < commentContent.length() || MIN_COMMENT_CONTENT_LENGTH > commentContent.length()) {
LOGGER.log(Level.WARN, "Comment conent length is invalid[{0}]", commentContent.length());
LOGGER.log(Level.WARN, "Comment conent length is invalid[{}]", commentContent.length());
ret.put(Keys.MSG, langPropsService.get("commentContentCannotEmptyLabel"));
return ret;
......@@ -300,7 +301,7 @@ public class CommentMgmtService {
ret.put(Common.IS_REPLY, true);
} else {
LOGGER.log(Level.WARN, "Not found orginal comment[id={0}] of reply[name={1}, content={2}]",
LOGGER.log(Level.WARN, "Not found orginal comment[id={}] of reply[name={}, content={}]",
originalCommentId, commentName, commentContent);
}
}
......
......@@ -18,10 +18,11 @@
package org.b3log.solo.service;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.model.Role;
import org.b3log.latke.model.User;
......@@ -60,7 +61,7 @@ public class CommentQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(CommentQueryService.class);
private static final Logger LOGGER = LogManager.getLogger(CommentQueryService.class);
/**
* User service.
......
......@@ -17,9 +17,10 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.Stopwatchs;
import org.b3log.solo.util.Solos;
......@@ -41,7 +42,7 @@ public class CronMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(CronMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(CronMgmtService.class);
/**
* Cron thread pool.
......
......@@ -20,6 +20,9 @@ package org.b3log.solo.service;
import freemarker.template.Template;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.event.Event;
......@@ -27,8 +30,6 @@ import org.b3log.latke.event.EventManager;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.model.Plugin;
import org.b3log.latke.model.Role;
......@@ -68,7 +69,7 @@ public class DataModelService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(DataModelService.class);
private static final Logger LOGGER = LogManager.getLogger(DataModelService.class);
/**
* Article repository.
......@@ -395,7 +396,7 @@ public class DataModelService {
if (!dateString.equals(lastDateString)) {
archiveDates2.add(archiveDate);
} else {
LOGGER.log(Level.DEBUG, "Found a duplicated archive date [{0}]", dateString);
LOGGER.log(Level.DEBUG, "Found a duplicated archive date [{}]", dateString);
}
}
}
......@@ -828,7 +829,7 @@ public class DataModelService {
final Map<String, Object> dataModel, final JSONObject preference) throws ServiceException {
Stopwatchs.start("Fill User Template[name=" + template.getName() + "]");
try {
LOGGER.log(Level.DEBUG, "Filling user template[name{0}]", template.getName());
LOGGER.log(Level.DEBUG, "Filling user template[name{}]", template.getName());
if (Templates.hasExpression(template, "<#list links as link>")) {
fillLinks(dataModel);
......
......@@ -24,11 +24,12 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Plugin;
import org.b3log.latke.model.User;
import org.b3log.latke.repository.*;
......@@ -48,6 +49,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
......@@ -67,7 +69,7 @@ public class ExportService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ExportService.class);
private static final Logger LOGGER = LogManager.getLogger(ExportService.class);
/**
* Archive date repository.
......@@ -235,7 +237,7 @@ public class ExportService {
final File localFile = new File(localFilePath);
try {
final byte[] data = sql.getBytes("UTF-8");
final byte[] data = sql.getBytes(StandardCharsets.UTF_8);
try (final OutputStream output = new FileOutputStream(localFile)) {
IOUtils.write(data, output);
}
......
......@@ -20,11 +20,12 @@ package org.b3log.solo.service;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.Strings;
import org.b3log.solo.model.Article;
......@@ -49,7 +50,7 @@ public class ImportService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ImportService.class);
private static final Logger LOGGER = LogManager.getLogger(ImportService.class);
/**
* Default tag.
......
......@@ -19,11 +19,12 @@ package org.b3log.solo.service;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Role;
import org.b3log.latke.model.User;
import org.b3log.latke.plugin.PluginManager;
......@@ -61,7 +62,7 @@ public class InitService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(InitService.class);
private static final Logger LOGGER = LogManager.getLogger(InitService.class);
/**
* Option repository.
......@@ -199,7 +200,7 @@ public class InitService {
final List<CreateTableResult> createTableResults = JdbcRepositories.initAllTables();
for (final CreateTableResult createTableResult : createTableResults) {
LOGGER.log(Level.DEBUG, "Creates table result [tableName={0}, isSuccess={1}]",
LOGGER.log(Level.DEBUG, "Creates table result [tableName={}, isSuccess={}]",
createTableResult.getName(), createTableResult.isSuccess());
}
}
......@@ -388,7 +389,7 @@ public class InitService {
final String tagTitle = tagTitle1.trim();
final JSONObject tag = new JSONObject();
LOGGER.log(Level.TRACE, "Found a new tag[title={0}] in article[title={1}]", tagTitle, article.optString(Article.ARTICLE_TITLE));
LOGGER.log(Level.TRACE, "Found a new tag[title={}] in article[title={}]", tagTitle, article.optString(Article.ARTICLE_TITLE));
tag.put(Tag.TAG_TITLE, tagTitle);
final String tagId = tagRepository.add(tag);
tag.put(Keys.OBJECT_ID, tagId);
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service;
......@@ -41,7 +42,7 @@ public class LinkMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(LinkMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(LinkMgmtService.class);
/**
* Link repository.
......@@ -138,7 +139,7 @@ public class LinkMgmtService {
transaction.rollback();
}
LOGGER.log(Level.WARN, "Cant not find the target link of source link[order={0}]", srcLinkOrder);
LOGGER.log(Level.WARN, "Cant not find the target link of source link[order={}]", srcLinkOrder);
return;
}
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.repository.Query;
import org.b3log.latke.repository.SortDirection;
......@@ -47,7 +48,7 @@ public class LinkQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(LinkQueryService.class);
private static final Logger LOGGER = LogManager.getLogger(LinkQueryService.class);
/**
* Link repository.
......
......@@ -17,9 +17,10 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.service.annotation.Service;
import org.b3log.solo.model.Option;
......@@ -39,7 +40,7 @@ public class OptionQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(OptionQueryService.class);
private static final Logger LOGGER = LogManager.getLogger(OptionQueryService.class);
/**
* Option repository.
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.service.LangPropsService;
......@@ -46,7 +47,7 @@ public class PageMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(PageMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(PageMgmtService.class);
/**
* Page repository.
......@@ -133,7 +134,7 @@ public class PageMgmtService {
pageRepository.update(pageId, newPage);
transaction.commit();
LOGGER.log(Level.DEBUG, "Updated a page[id={0}]", pageId);
LOGGER.log(Level.DEBUG, "Updated a page[id={}]", pageId);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e);
if (transaction.isActive()) {
......@@ -247,7 +248,7 @@ public class PageMgmtService {
transaction.rollback();
}
LOGGER.log(Level.WARN, "Cant not find the target page of source page[order={0}]", srcPageOrder);
LOGGER.log(Level.WARN, "Cant not find the target page of source page[order={}]", srcPageOrder);
return;
}
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.repository.Query;
import org.b3log.latke.repository.SortDirection;
......@@ -47,7 +48,7 @@ public class PageQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(PageQueryService.class);
private static final Logger LOGGER = LogManager.getLogger(PageQueryService.class);
/**
* Page repository.
......
......@@ -18,10 +18,11 @@
package org.b3log.solo.service;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.Strings;
......@@ -44,7 +45,7 @@ public class PermalinkQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(PermalinkQueryService.class);
private static final Logger LOGGER = LogManager.getLogger(PermalinkQueryService.class);
/**
* Page repository.
......
......@@ -18,11 +18,12 @@
package org.b3log.solo.service;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Plugin;
import org.b3log.latke.plugin.AbstractPlugin;
import org.b3log.latke.plugin.PluginManager;
......@@ -51,7 +52,7 @@ public class PluginMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(PluginMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(PluginMgmtService.class);
/**
* Plugin repository.
......@@ -118,7 +119,7 @@ public class PluginMgmtService {
pluginRepository.add(pluginDesc);
LOGGER.log(Level.TRACE, "Refreshed plugin[{0}]", pluginDesc);
LOGGER.log(Level.TRACE, "Refreshed plugin[{}]", pluginDesc);
}
} catch (final Exception e) {
......
......@@ -17,9 +17,10 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.model.Plugin;
import org.b3log.latke.plugin.AbstractPlugin;
......@@ -48,7 +49,7 @@ public class PluginQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(PluginQueryService.class);
private static final Logger LOGGER = LogManager.getLogger(PluginQueryService.class);
/**
* Plugin repository.
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
......@@ -46,7 +47,7 @@ public class PreferenceMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(PreferenceMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(PreferenceMgmtService.class);
/**
* Option query service.
......
......@@ -17,9 +17,10 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
......@@ -44,7 +45,7 @@ public class SkinMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(SkinMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(SkinMgmtService.class);
/**
* Option query service.
......@@ -74,7 +75,7 @@ public class SkinMgmtService {
final Set<String> skinDirNames = Skins.getSkinDirNames();
final String currentSkinDirName = skin.optString(Option.ID_C_SKIN_DIR_NAME);
if (!skinDirNames.contains(currentSkinDirName)) {
LOGGER.log(Level.WARN, "Not found skin [dirName={0}] configured, try to use default skin [dirName="
LOGGER.log(Level.WARN, "Not found skin [dirName={}] configured, try to use default skin [dirName="
+ Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME + "] instead", currentSkinDirName);
if (!skinDirNames.contains(Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME)) {
LOGGER.log(Level.ERROR, "Not found default skin [dirName=" + Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME
......@@ -88,7 +89,7 @@ public class SkinMgmtService {
final String currentMobileSkinDirName = skin.optString(Option.ID_C_MOBILE_SKIN_DIR_NAME);
if (!skinDirNames.contains(currentMobileSkinDirName)) {
LOGGER.log(Level.WARN, "Not found mobile skin [dirName={0}] configured, try to use default mobile skin [dirName="
LOGGER.log(Level.WARN, "Not found mobile skin [dirName={}] configured, try to use default mobile skin [dirName="
+ Option.DefaultPreference.DEFAULT_MOBILE_SKIN_DIR_NAME + "] instead", currentMobileSkinDirName);
if (!skinDirNames.contains(Option.DefaultPreference.DEFAULT_MOBILE_SKIN_DIR_NAME)) {
LOGGER.log(Level.ERROR, "Not found default mobile skin [dirName=" + Option.DefaultPreference.DEFAULT_MOBILE_SKIN_DIR_NAME
......
......@@ -17,13 +17,14 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.http.Cookie;
import org.b3log.latke.http.Request;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.Response;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
......@@ -63,7 +64,7 @@ public class StatisticMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(StatisticMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(StatisticMgmtService.class);
/**
* Online visitor expiration in 5 minutes.
......@@ -112,11 +113,11 @@ public class StatisticMgmtService {
if (currentTimeMillis > (onlineVisitor.getValue() + ONLINE_VISITOR_EXPIRATION)) {
iterator.remove();
LOGGER.log(Level.TRACE, "Removed online visitor[ip={0}]", onlineVisitor.getKey());
LOGGER.log(Level.TRACE, "Removed online visitor[ip={}]", onlineVisitor.getKey());
}
}
LOGGER.log(Level.DEBUG, "Current online visitor count [{0}]", ONLINE_VISITORS.size());
LOGGER.log(Level.DEBUG, "Current online visitor count [{}]", ONLINE_VISITORS.size());
}
/**
......@@ -227,7 +228,7 @@ public class StatisticMgmtService {
// return;
// }
//
// LOGGER.log(Level.TRACE, "Before inc blog view count is [{0}]", statistic);
// LOGGER.log(Level.TRACE, "Before inc blog view count is [{}]", statistic);
//
// statistic.put(Option.OPTION_VALUE, statistic.optInt(Option.OPTION_VALUE) + 1);
//
......@@ -244,7 +245,7 @@ public class StatisticMgmtService {
// return;
// }
//
// LOGGER.log(Level.TRACE, "Inced blog view count[statistic={0}]", statistic);
// LOGGER.log(Level.TRACE, "Inced blog view count[statistic={}]", statistic);
}
/**
......@@ -258,9 +259,9 @@ public class StatisticMgmtService {
}
final String remoteAddr = Requests.getRemoteAddr(request);
LOGGER.log(Level.DEBUG, "Current request [IP={0}]", remoteAddr);
LOGGER.log(Level.DEBUG, "Current request [IP={}]", remoteAddr);
ONLINE_VISITORS.put(remoteAddr, System.currentTimeMillis());
LOGGER.log(Level.DEBUG, "Current online visitor count [{0}]", ONLINE_VISITORS.size());
LOGGER.log(Level.DEBUG, "Current online visitor count [{}]", ONLINE_VISITORS.size());
}
/**
......
......@@ -17,9 +17,10 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.FilterOperator;
import org.b3log.latke.repository.PropertyFilter;
import org.b3log.latke.repository.Query;
......@@ -43,7 +44,7 @@ public class StatisticQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(StatisticQueryService.class);
private static final Logger LOGGER = LogManager.getLogger(StatisticQueryService.class);
/**
* Option query service.
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service;
......@@ -44,7 +45,7 @@ public class TagMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(TagMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(TagMgmtService.class);
/**
* Tag query service.
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Query;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.service.ServiceException;
......@@ -45,7 +46,7 @@ public class TagQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(TagQueryService.class);
private static final Logger LOGGER = LogManager.getLogger(TagQueryService.class);
/**
* Tag repository.
......
......@@ -17,9 +17,10 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.annotation.Service;
import org.b3log.solo.Server;
import org.b3log.solo.model.Option;
......@@ -39,7 +40,7 @@ public class UpgradeService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(UpgradeService.class);
private static final Logger LOGGER = LogManager.getLogger(UpgradeService.class);
/**
* Option Query Service.
......
......@@ -20,11 +20,12 @@ package org.b3log.solo.service;
import jodd.http.HttpRequest;
import jodd.http.HttpResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Role;
import org.b3log.latke.model.User;
import org.b3log.latke.repository.RepositoryException;
......@@ -55,7 +56,7 @@ public class UserMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(UserMgmtService.class);
private static final Logger LOGGER = LogManager.getLogger(UserMgmtService.class);
/**
* Length of hashed password.
......
......@@ -17,11 +17,12 @@
*/
package org.b3log.solo.service;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.model.User;
import org.b3log.latke.repository.FilterOperator;
......@@ -52,7 +53,7 @@ public class UserQueryService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(UserQueryService.class);
private static final Logger LOGGER = LogManager.getLogger(UserQueryService.class);
/**
* User repository.
......
......@@ -2,3 +2,4 @@
* Services.
*/
package org.b3log.solo.service;
......@@ -17,11 +17,12 @@
*/
package org.b3log.solo.upgrade;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.repository.jdbc.util.Connections;
import org.b3log.latke.util.CollectionUtils;
......@@ -48,7 +49,7 @@ public final class V299_300 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V299_300.class);
private static final Logger LOGGER = LogManager.getLogger(V299_300.class);
/**
* Performs upgrade from v2.9.9 to v3.0.0.
......
......@@ -18,11 +18,12 @@
package org.b3log.solo.upgrade;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Query;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.repository.jdbc.util.Connections;
......@@ -49,7 +50,7 @@ public final class V300_310 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V300_310.class);
private static final Logger LOGGER = LogManager.getLogger(V300_310.class);
/**
* Performs upgrade from v3.0.0 to v3.1.0.
......
......@@ -17,11 +17,12 @@
*/
package org.b3log.solo.upgrade;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.FilterOperator;
import org.b3log.latke.repository.PropertyFilter;
import org.b3log.latke.repository.Query;
......@@ -49,7 +50,7 @@ public final class V310_320 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V310_320.class);
private static final Logger LOGGER = LogManager.getLogger(V310_320.class);
/**
* Performs upgrade from v3.1.0 to v3.2.0.
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.upgrade;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.OptionRepository;
......@@ -38,7 +39,7 @@ public final class V320_330 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V320_330.class);
private static final Logger LOGGER = LogManager.getLogger(V320_330.class);
/**
* Performs upgrade from v3.2.0 to v3.3.0.
......
......@@ -17,11 +17,12 @@
*/
package org.b3log.solo.upgrade;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.repository.jdbc.util.Connections;
import org.b3log.solo.model.Option;
......@@ -44,7 +45,7 @@ public final class V330_340 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V330_340.class);
private static final Logger LOGGER = LogManager.getLogger(V330_340.class);
/**
* Performs upgrade from v3.3.0 to v3.4.0.
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.upgrade;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.OptionRepository;
......@@ -38,7 +39,7 @@ public final class V340_350 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V340_350.class);
private static final Logger LOGGER = LogManager.getLogger(V340_350.class);
/**
* Performs upgrade from v3.4.0 to v3.5.0.
......
......@@ -17,11 +17,12 @@
*/
package org.b3log.solo.upgrade;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.FilterOperator;
import org.b3log.latke.repository.PropertyFilter;
import org.b3log.latke.repository.Query;
......@@ -52,7 +53,7 @@ public final class V350_360 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V350_360.class);
private static final Logger LOGGER = LogManager.getLogger(V350_360.class);
/**
* Performs upgrade from v3.5.0 to v3.6.0.
......
......@@ -17,9 +17,10 @@
*/
package org.b3log.solo.upgrade;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.OptionRepository;
......@@ -37,7 +38,7 @@ public final class V360_361 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V360_361.class);
private static final Logger LOGGER = LogManager.getLogger(V360_361.class);
/**
* Performs upgrade from v3.6.0 to v3.6.1.
......
......@@ -18,10 +18,11 @@
package org.b3log.solo.upgrade;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Query;
import org.b3log.latke.repository.Transaction;
import org.b3log.solo.model.Comment;
......@@ -45,7 +46,7 @@ public final class V361_362 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V361_362.class);
private static final Logger LOGGER = LogManager.getLogger(V361_362.class);
/**
* Performs upgrade from v3.6.1 to v3.6.2.
......
......@@ -18,10 +18,11 @@
package org.b3log.solo.upgrade;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Query;
import org.b3log.latke.repository.Transaction;
import org.b3log.solo.model.Article;
......@@ -45,7 +46,7 @@ public final class V362_363 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V362_363.class);
private static final Logger LOGGER = LogManager.getLogger(V362_363.class);
/**
* Performs upgrade from v3.6.2 to v3.6.3.
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.upgrade;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.OptionRepository;
......@@ -38,7 +39,7 @@ public final class V363_364 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V363_364.class);
private static final Logger LOGGER = LogManager.getLogger(V363_364.class);
/**
* Performs upgrade from v3.6.3 to v3.6.4.
......
......@@ -17,9 +17,10 @@
*/
package org.b3log.solo.upgrade;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.OptionRepository;
......@@ -37,7 +38,7 @@ public final class V364_365 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V364_365.class);
private static final Logger LOGGER = LogManager.getLogger(V364_365.class);
/**
* Performs upgrade from v3.6.4 to v3.6.5.
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.upgrade;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.repository.jdbc.util.Connections;
import org.b3log.solo.model.Option;
......@@ -42,7 +43,7 @@ public final class V365_366 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V365_366.class);
private static final Logger LOGGER = LogManager.getLogger(V365_366.class);
/**
* Performs upgrade from v3.6.5 to v3.6.6.
......
......@@ -17,10 +17,11 @@
*/
package org.b3log.solo.upgrade;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.*;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.ArchiveDateArticleRepository;
......@@ -41,7 +42,7 @@ public final class V366_367 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V366_367.class);
private static final Logger LOGGER = LogManager.getLogger(V366_367.class);
/**
* Performs upgrade from v3.6.6 to v3.6.7.
......
......@@ -17,18 +17,15 @@
*/
package org.b3log.solo.upgrade;
import org.b3log.latke.Latkes;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.*;
import org.b3log.latke.repository.Transaction;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.ArchiveDateArticleRepository;
import org.b3log.solo.repository.OptionRepository;
import org.json.JSONObject;
import java.util.List;
/**
* Upgrade script from v3.6.7 to v3.6.8.
*
......@@ -41,7 +38,7 @@ public final class V367_368 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V367_368.class);
private static final Logger LOGGER = LogManager.getLogger(V367_368.class);
/**
* Performs upgrade from v3.6.7 to v3.6.8.
......
......@@ -17,9 +17,10 @@
*/
package org.b3log.solo.upgrade;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Transaction;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.OptionRepository;
......@@ -37,7 +38,7 @@ public final class V368_370 {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(V368_370.class);
private static final Logger LOGGER = LogManager.getLogger(V368_370.class);
/**
* Performs upgrade from v3.6.8 to v3.7.0.
......
......@@ -2,3 +2,4 @@
* Upgrade scripts.
*/
package org.b3log.solo.upgrade;
......@@ -19,9 +19,10 @@ package org.b3log.solo.util;
import jodd.http.HttpRequest;
import jodd.http.HttpResponse;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.solo.model.Common;
import org.json.JSONArray;
import org.json.JSONObject;
......@@ -38,7 +39,7 @@ public final class GitHubs {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(GitHubs.class);
private static final Logger LOGGER = LogManager.getLogger(GitHubs.class);
/**
* Gets GitHub repos.
......
......@@ -20,8 +20,9 @@ package org.b3log.solo.util;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.lang.time.DateUtils;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
......@@ -39,7 +40,7 @@ public final class Images {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(Images.class);
private static final Logger LOGGER = LogManager.getLogger(Images.class);
/**
* Community file service URL.
......
......@@ -27,10 +27,11 @@ import com.vladsch.flexmark.util.data.MutableDataSet;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.util.Callstacks;
import org.b3log.latke.util.Stopwatchs;
......@@ -47,6 +48,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.*;
......@@ -66,7 +68,7 @@ public final class Markdowns {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(Markdowns.class);
private static final Logger LOGGER = LogManager.getLogger(Markdowns.class);
/**
* Markdown cache.
......@@ -270,7 +272,7 @@ public final class Markdowns {
String ret;
try (final InputStream inputStream = conn.getInputStream()) {
ret = IOUtils.toString(inputStream, "UTF-8");
ret = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
}
conn.disconnect();
......
......@@ -21,14 +21,15 @@ import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateExceptionHandler;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.Cookie;
import org.b3log.latke.http.Request;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.util.Locales;
......@@ -56,7 +57,7 @@ public final class Skins {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(Skins.class);
private static final Logger LOGGER = LogManager.getLogger(Skins.class);
/**
* FreeMarker configuration.
......@@ -162,7 +163,7 @@ public final class Skins {
final String country = Locales.getCountry(localeString);
final InputStream inputStream = Skins.class.getResourceAsStream("/skins/" + currentSkinDirName + "/lang/lang_" + language + '_' + country + ".properties");
if (null != inputStream) {
LOGGER.log(Level.DEBUG, "Loading skin [dirName={0}, locale={1}]", currentSkinDirName, localeString);
LOGGER.log(Level.DEBUG, "Loading skin [dirName={}, locale={}]", currentSkinDirName, localeString);
final Properties props = new Properties();
props.load(inputStream);
inputStream.close();
......@@ -174,7 +175,7 @@ public final class Skins {
}
LANG_MAP.put(langName, langs);
LOGGER.log(Level.DEBUG, "Loaded skin [dirName={0}, locale={1}, keyCount={2}]", currentSkinDirName, localeString, langs.size());
LOGGER.log(Level.DEBUG, "Loaded skin [dirName={}, locale={}, keyCount={}]", currentSkinDirName, localeString, langs.size());
}
}
......
......@@ -21,12 +21,13 @@ import jodd.http.HttpRequest;
import jodd.http.HttpResponse;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.*;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.model.Role;
import org.b3log.latke.model.User;
......@@ -59,7 +60,7 @@ public final class Solos {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(Solos.class);
private static final Logger LOGGER = LogManager.getLogger(Solos.class);
/**
* Favicon API.
......
......@@ -2,3 +2,4 @@
* Utilities.
*/
package org.b3log.solo.util;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment