Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
a9540f3b
Commit
a9540f3b
authored
Apr 02, 2020
by
Liyuan Li
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
196b9439
2f3101b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
68 deletions
+25
-68
src/main/java/org/b3log/solo/Server.java
src/main/java/org/b3log/solo/Server.java
+2
-6
src/main/java/org/b3log/solo/processor/console/LogConsole.java
...ain/java/org/b3log/solo/processor/console/LogConsole.java
+0
-61
src/main/java/org/b3log/solo/processor/console/OtherConsole.java
...n/java/org/b3log/solo/processor/console/OtherConsole.java
+23
-1
No files found.
src/main/java/org/b3log/solo/Server.java
View file @
a9540f3b
...
...
@@ -81,7 +81,7 @@ public final class Server extends BaseServer {
public
static
void
initInMemoryLogger
()
{
final
LoggerContext
ctx
=
(
LoggerContext
)
LogManager
.
getContext
(
false
);
final
Configuration
config
=
ctx
.
getConfiguration
();
final
StringLayout
layout
=
PatternLayout
.
newBuilder
().
build
();
final
StringLayout
layout
=
PatternLayout
.
newBuilder
().
withPattern
(
"[%-5p]-[%d{yyyy-MM-dd HH:mm:ss}]-[%c:%L]: %m%n"
).
build
();
final
Appender
appender
=
WriterAppender
.
createAppender
(
layout
,
null
,
TAIL_LOGGER_WRITER
,
"InMemoryTail"
,
true
,
true
);
appender
.
start
();
config
.
addAppender
(
appender
);
...
...
@@ -618,6 +618,7 @@ public final class Server extends BaseServer {
otherConsoleGroup
.
middlewares
(
consoleAdminAuthMidware:
:
handle
);
otherConsoleGroup
.
delete
(
"/console/archive/unused"
,
otherConsole:
:
removeUnusedArchives
).
delete
(
"/console/tag/unused"
,
otherConsole:
:
removeUnusedTags
);
otherConsoleGroup
.
get
(
"/console/log"
,
otherConsole:
:
getLog
);
final
UserConsole
userConsole
=
beanManager
.
getReference
(
UserConsole
.
class
);
final
Dispatcher
.
RouterGroup
userConsoleGroup
=
Dispatcher
.
group
();
...
...
@@ -632,11 +633,6 @@ public final class Server extends BaseServer {
final
Dispatcher
.
RouterGroup
staticSiteConsoleGroup
=
Dispatcher
.
group
();
staticSiteConsoleGroup
.
middlewares
(
consoleAdminAuthMidware:
:
handle
);
staticSiteConsoleGroup
.
put
(
"/console/staticsite"
,
staticSiteConsole:
:
genSite
);
final
LogConsole
logConsole
=
beanManager
.
getReference
(
LogConsole
.
class
);
final
Dispatcher
.
RouterGroup
logConsoleGroup
=
Dispatcher
.
group
();
logConsoleGroup
.
middlewares
(
consoleAdminAuthMidware:
:
handle
);
logConsoleGroup
.
get
(
"/console/log"
,
logConsole:
:
getLog
);
}
/**
...
...
src/main/java/org/b3log/solo/processor/console/LogConsole.java
deleted
100644 → 0
View file @
196b9439
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-present, b3log.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package
org
.
b3log
.
solo
.
processor
.
console
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.b3log.latke.http.RequestContext
;
import
org.b3log.latke.ioc.Singleton
;
import
org.b3log.solo.Server
;
/**
* Log console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Apr 2, 2020
* @since 4.1.0
*/
@Singleton
public
class
LogConsole
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
LogManager
.
getLogger
(
LogConsole
.
class
);
/**
* Get log.
* <p>
* Renders the response with a json object, for example,
* <pre>
* {
* "sc": boolean,
* "log": "log lines"
* }
* </pre>
* </p>
*
* @param context the specified request context
*/
public
void
getLog
(
final
RequestContext
context
)
{
context
.
renderJSON
(
true
);
final
String
content
=
Server
.
TAIL_LOGGER_WRITER
.
toString
();
context
.
renderJSONValue
(
"log"
,
content
);
}
}
src/main/java/org/b3log/solo/processor/console/OtherConsole.java
View file @
a9540f3b
...
...
@@ -26,6 +26,7 @@ import org.b3log.latke.http.renderer.JsonRenderer;
import
org.b3log.latke.ioc.Inject
;
import
org.b3log.latke.ioc.Singleton
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.solo.Server
;
import
org.b3log.solo.service.ArchiveDateMgmtService
;
import
org.b3log.solo.service.TagMgmtService
;
import
org.json.JSONObject
;
...
...
@@ -34,7 +35,7 @@ import org.json.JSONObject;
* Other console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.
0.0.0, Feb 9
, 2020
* @version 2.
1.0.0, Apr 2
, 2020
* @since 3.4.0
*/
@Singleton
...
...
@@ -63,6 +64,27 @@ public class OtherConsole {
@Inject
private
LangPropsService
langPropsService
;
/**
* Get log.
* <p>
* Renders the response with a json object, for example,
* <pre>
* {
* "sc": boolean,
* "log": "log lines"
* }
* </pre>
* </p>
*
* @param context the specified request context
*/
public
void
getLog
(
final
RequestContext
context
)
{
context
.
renderJSON
(
true
);
final
String
content
=
Server
.
TAIL_LOGGER_WRITER
.
toString
();
context
.
renderJSONValue
(
"log"
,
content
);
}
/**
* Removes all unused archives.
* <p>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment