Commit 0b4f6d0d by 袁伟铭

删除日志配置

parent 1ca72d3d
......@@ -79,6 +79,6 @@ share:
#应用app-secret
app-secret: 7774049b-3c89-4a20-8d4f-6bdfa972e86e
#API地址
api-url: http://59.211.219.66:8081
api-url: http://192.168.0.253:9066
#token获取接口
token-url: http://59.211.219.66:8081/epoint-sso-web/rest/oauth2/token
token-url: http://192.168.0.253:9066/epoint-sso-web/rest/oauth2/token
......@@ -42,7 +42,7 @@ public class ShareApiUtils {
String token = redisUtils.getStr("shareApiAuthorization");
if (StringUtils.isNotBlank(token)) {
headers.put("Authorization", token);
headers.put("Authorization", "Bearer " + token);
} else {
Map<String, String> params = new HashMap<>();
params.put("grant_type", "client_credentials");
......@@ -50,7 +50,7 @@ public class ShareApiUtils {
params.put("client_id", shareApiConfig.getAppKey());
params.put("client_secret", shareApiConfig.getAppSecret());
log.debug("获取token-请求URL: {}", shareApiConfig.getTokenUrl());
log.debug("获取token请求: {}", JSON.toJSONString(params));
log.debug("获取token-请求参数: {}", JSON.toJSONString(params));
String result = HttpRequest.post(shareApiConfig.getTokenUrl())
.formStr(params)
......@@ -65,7 +65,7 @@ public class ShareApiUtils {
if ("1".equals(code)) {
JSONObject custom = jobj.getJSONObject("custom");
token = jobj.getJSONObject("custom").getString("access_token");
headers.put("Authorization", token);
headers.put("Authorization", "Bearer " + token);
redisUtils.setStr("shareApiAuthorization", token, custom.getLong("expires_in") - 10, TimeUnit.SECONDS);
}
......@@ -100,7 +100,7 @@ public class ShareApiUtils {
public static ShareApiResponse doPost(Map<String, Object> params, ShareApiEnum apiEnum, boolean isTipError) {
String body = JSON.toJSONString(params);
log.debug(apiEnum.getLabel() + "-请求URL: {}", shareApiConfig.getApiUrl() + apiEnum.getUrl());
log.debug(apiEnum.getLabel() + "-请求: {}", body);
log.debug(apiEnum.getLabel() + "-请求参数: {}", body);
String result = HttpRequest.post(shareApiConfig.getApiUrl() + apiEnum.getUrl())
.body(body)
.header("Content-Type", "application/json;charset=utf-8")
......@@ -111,7 +111,7 @@ public class ShareApiUtils {
ShareApiResponse shareApiResponse = JSON.parseObject(result, ShareApiResponse.class);
if (isTipError) {
AssertUtils.isTrue(shareApiResponse.isSuccess(), shareApiResponse.getError());
AssertUtils.isTrue(shareApiResponse.isSuccess(), shareApiResponse.getMessage());
}
return shareApiResponse;
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--<include resource="org/springframework/boot/logging/logback/base.xml"/>-->
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
<property name="default_log_path" value="logs"/>
<property name="default_log_file" value="resource"/><!--主要日志文件名-->
<property name="LOG_PATH" value="${LOG_PATH:-${default_log_path}}"/>
<property name="LOG_FILE" value="${LOG_FILE:-${default_log_file}}"/>
<!-- the name of the application's logging context -->
<!-- by default each JMXConfigurator instance will be registered under the same name in the same JVM -->
<!-- we need to set the contextName for different apps, so that the jmxconfigurator won't collide -->
<contextName>user</contextName>
<jmxConfigurator/>
<!--主要日志配置 开始-->
<appender name="SIZED_ROLLING_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<pattern>%d %-5p [%t] %logger : %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
<file>${LOG_FILE}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- 日志文档保留天数 -->
<maxHistory>15</maxHistory>
</rollingPolicy>
</appender>
<!-- 异步输出 -->
<appender name="main-logger-appender" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>512</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="SIZED_ROLLING_FILE"/>
</appender>
<!--主要日志配置 结束-->
<!--共享平台接口日志配置 开始-->
<appender name="SHARE_REQUEST_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<pattern>%d %-5p [%t] %logger : %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
<file>share-api-request.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/share-api-request.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- 日志文档保留天数 -->
<maxHistory>15</maxHistory>
</rollingPolicy>
</appender>
<!-- 异步输出 -->
<appender name="share-request-appender" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>512</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="SHARE_REQUEST_FILE"/>
</appender>
<!--限流日志配置 结束-->
<!-- 多环境配置 按照active profile选择分支 -->
<springProfile name="dev">
<logger name="com.zq" level="DEBUG"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
<springProfile name="product">
<!--生产环境日志分开输出方便查找-->
<logger name="com.zq" level="INFO"/>
<logger name="com.zq.resource.utils.ShareApiUtils" additivity="false" level="DEBUG">
<appender-ref ref="share-request-appender"/>
</logger>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="main-logger-appender"/>
</root>
</springProfile>
</configuration>
\ No newline at end of file
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