Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
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
head_group
xyqb-user2
Commits
88b6db71
Commit
88b6db71
authored
Dec 29, 2017
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
技术升级:confluence 17/12/18-平滑退出&全链路跟踪
parent
08b42294
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
6 deletions
+66
-6
pom.xml
pom.xml
+8
-2
Bootstrap.java
src/main/java/cn/quantgroup/xyqb/Bootstrap.java
+7
-4
logback-dev.xml
src/main/resources/logback-dev.xml
+24
-0
logback-pro.xml
src/main/resources/logback-pro.xml
+27
-0
No files found.
pom.xml
View file @
88b6db71
...
...
@@ -228,7 +228,14 @@
<dependency>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo-client
</artifactId>
<version>
0.10.0
</version>
<version>
0.10.1
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
commons
</artifactId>
<version>
0.0.5
</version>
<scope>
compile
</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>cn.quantgroup</groupId>-->
...
...
@@ -366,7 +373,6 @@
<id>
test
</id>
<properties>
<profiles.activation>
test
</profiles.activation>
</properties>
<dependencies>
<dependency>
...
...
src/main/java/cn/quantgroup/xyqb/Bootstrap.java
View file @
88b6db71
...
...
@@ -10,19 +10,21 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.context.event.ContextRefreshedEvent
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
cn.quantgroup.tech.shutdown.DefaultSignalHandler
;
import
sun.misc.Signal
;
@ComponentScan
(
basePackages
=
{
"cn.quantgroup.sms"
,
"cn.quantgroup.xyqb"
})
@EnableAutoConfiguration
@SpringBootApplication
@EnableCaching
//@EnableApolloConfig({"application", "tech.msg.sdk", "cash.common"})
@EnableApolloConfig
@PropertySource
(
value
=
{
"classpath:application.properties"
,
"classpath:xyqb.properties"
},
ignoreResourceNotFound
=
true
)
@Configuration
...
...
@@ -33,8 +35,7 @@ public class Bootstrap {
public
static
void
main
(
String
[]
args
)
{
SpringApplication
springApplication
=
new
SpringApplication
(
Bootstrap
.
class
);
springApplication
.
addInitializers
(
new
ApolloPropertySourceInitializer
(
"application"
,
"tech.msg.sdk"
,
"cash.common"
));
springApplication
.
addInitializers
(
new
ApolloPropertySourceInitializer
(
"application"
,
"tech.msg.sdk"
,
"tech.sleuth"
,
"tech.common"
,
"cash.common"
));
springApplication
.
addListeners
(
new
ApplicationListener
<
ContextRefreshedEvent
>()
{
@Override
public
void
onApplicationEvent
(
ContextRefreshedEvent
event
)
{
...
...
@@ -43,7 +44,9 @@ public class Bootstrap {
}
});
springApplication
.
setRegisterShutdownHook
(
true
);
springApplication
.
run
(
args
);
ConfigurableApplicationContext
run
=
springApplication
.
run
(
args
);
log
.
info
(
"server start..."
);
// 启用平滑退出功能
Signal
.
handle
(
new
Signal
(
"INT"
),
new
DefaultSignalHandler
(
run
));
}
}
src/main/resources/logback-dev.xml
0 → 100644
View file @
88b6db71
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<springProperty
name=
"spring.application.name"
source=
"spring.application.name"
/>
<property
name=
"LOG_LEVEL_PATTERN"
value=
"%clr(%5p) %clr([${spring.application.name:-},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}]){yellow}"
/>
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"${CONSOLE_LOG_PATTERN:-%clr(%d{MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%10.10t]){faint} [%40.40file:%4.4line] %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"
/>
<!-- 这里面定义了 CONSOLE_LOG_PATTERN, FILE_LOG_PATTERN 等日志格式, 还定义了一些日志级别 -->
<include
resource=
"org/springframework/boot/logging/logback/defaults.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/console-appender.xml"
/>
<logger
name=
"cn.quantgroup"
level=
"DEBUG"
/>
<logger
name=
"org.springframework"
level=
"INFO"
/>
<!--<logger name="java.sql.Connection" level="DEBUG"/>-->
<!--<logger name="java.sql.Statement" level="DEBUG"/>-->
<!--<logger name="java.sql.PreparedStatement" level="DEBUG"/>-->
<logger
name=
"org.hibernate"
level=
"warn"
/>
<logger
name=
"org.apache"
level=
"warn"
/>
<logger
name=
"ch.qos.logback"
level=
"warn"
/>
<root
level=
"INFO"
>
<appender-ref
ref=
"CONSOLE"
/>
</root>
</configuration>
\ No newline at end of file
src/main/resources/logback-pro.xml
0 → 100644
View file @
88b6db71
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<springProperty
name=
"spring.application.name"
source=
"spring.application.name"
/>
<property
name=
"LOG_LEVEL_PATTERN"
value=
"%5p [${spring.application.name:-},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}]"
/>
<property
name=
"FILE_LOG_PATTERN"
value=
"${FILE_LOG_PATTERN:-%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} --- [%thread] [%file:%line] %logger - %msg%n}"
/>
<appender
name=
"FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
/home/quant_group/logs/${spring.application.name:-application}.log
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
/home/quant_group/logs/${spring.application.name:-application}.log.%d{yyyy-MM-dd}
</fileNamePattern>
<maxHistory>
30
</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
${FILE_LOG_PATTERN}
</pattern>
</encoder>
</appender>
<logger
name=
"org.springframework"
level=
"warn"
/>
<logger
name=
"org.hibernate"
level=
"warn"
/>
<logger
name=
"org.apache"
level=
"warn"
/>
<logger
name=
"ch.qos.logback"
level=
"warn"
/>
<root
level=
"info"
>
<appender-ref
ref=
"FILE"
/>
</root>
</configuration>
\ No newline at end of file
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