Compare commits

...

4 Commits

Author SHA1 Message Date
933de62469 JSON log 2025-09-15 07:21:04 +05:00
c18e94ca48 Repair: Cookie language_id 2025-08-06 10:12:15 +05:00
9ee0aca24a logger.info 2025-07-14 17:35:32 +05:00
0a4c1948b0 Add springdoc 2025-06-30 07:22:30 +05:00
13 changed files with 371 additions and 45 deletions

View File

@ -11,9 +11,11 @@ issuer:
spring: spring:
application: application:
name: org_ccalm_dbms name: org-ccalm-dbms
datasource: datasource:
url: jdbc:postgresql://91.201.214.156:5432/CCALM?ApplicationName=org_ccalm_dbms&ssl=true&sslmode=require&connectTimeout=10000&socketTimeout=10000 url: jdbc:postgresql://10.0.0.1:5432/CCALM?ApplicationName=org_ccalm_dbms&connectTimeout=10000&socketTimeout=30000
#url: jdbc:postgresql://91.201.214.156:5432/CCALM?ApplicationName=org_ccalm_dbms&ssl=true&sslmode=require&connectTimeout=10000&socketTimeout=10000
#url: jdbc:postgresql://127.0.0.1:5432/CCALM?ApplicationName=org_ccalm_dbms&ssl=true&sslmode=require&connectTimeout=10000&socketTimeout=10000
username: postgres username: postgres
password: 309A86FF65A78FB428F4E38DFE35F730 password: 309A86FF65A78FB428F4E38DFE35F730
driver-class-name: org.postgresql.Driver driver-class-name: org.postgresql.Driver
@ -41,7 +43,6 @@ access:
refresh: refresh:
time: 43200 time: 43200
mail: mail:
host: smtp.yandex.ru host: smtp.yandex.ru
port: 465 port: 465
@ -52,6 +53,9 @@ url:
reset: http://127.0.0.1:8088/reset reset: http://127.0.0.1:8088/reset
main: http://127.0.0.1:8088/ main: http://127.0.0.1:8088/
data:
dir: O:\temp\
#logging: #logging:
# level: # level:
# com: # com:

32
pom.xml
View File

@ -5,12 +5,12 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.2</version> <version>3.5.5</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
<groupId>org.ccalm</groupId> <groupId>org.ccalm</groupId>
<artifactId>dbms</artifactId> <artifactId>dbms</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>1.0.2</version>
<name>dbms</name> <name>dbms</name>
<description>Database management system</description> <description>Database management system</description>
<url/> <url/>
@ -100,9 +100,35 @@
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.16.1</version> <version>2.16.1</version>
</dependency> </dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.8.4</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>8.1</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>org-ccalm-dbms</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -121,7 +147,7 @@
<version>2.22.2</version> <version>2.22.2</version>
<configuration> <configuration>
<systemPropertyVariables> <systemPropertyVariables>
<spring.config.location>file:kz_mcp_dbms.properties</spring.config.location> <spring.config.location>file:org_ccalm_dbms.yml</spring.config.location>
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>

View File

@ -275,7 +275,8 @@ public class DBMSRecords implements ServletContextAware {
@ModelAttribute User user, @ModelAttribute User user,
@RequestBody(required = false) byte[] reqData, @RequestBody(required = false) byte[] reqData,
@CookieValue(value = "jwt_a", defaultValue = "") String jwt_a, @CookieValue(value = "jwt_a", defaultValue = "") String jwt_a,
@RequestParam(required=false,name="lng") String language_id //@RequestParam(required=false,name="lng") String language_id
@CookieValue(value = "lng", defaultValue = "3") String language_id
) { ) {
final HttpHeaders httpHeaders= new HttpHeaders(); final HttpHeaders httpHeaders= new HttpHeaders();
httpHeaders.setContentType(MediaType.APPLICATION_JSON); httpHeaders.setContentType(MediaType.APPLICATION_JSON);
@ -300,7 +301,6 @@ public class DBMSRecords implements ServletContextAware {
user.id = claims.getBody().get("user_id").toString(); user.id = claims.getBody().get("user_id").toString();
} }
if(language_id!=null && !language_id.equals("")) if(language_id!=null && !language_id.equals(""))
user.language_id=language_id; user.language_id=language_id;
logger.info("user.id="+user.id+" user.name="+user.name+" user.language_id="+user.language_id+" user.country_id="+user.country_id); logger.info("user.id="+user.id+" user.name="+user.name+" user.language_id="+user.language_id+" user.country_id="+user.country_id);
@ -362,7 +362,6 @@ public class DBMSRecords implements ServletContextAware {
reqNode = doc.getDocumentElement(); reqNode = doc.getDocumentElement();
fn = reqNode.getAttribute("fn"); //Номер функции fn = reqNode.getAttribute("fn"); //Номер функции
} }
//logger.info(""); //logger.info("");
//logger.info("XML = "); //logger.info("XML = ");
//logger.info(toString(doc)); //logger.info(toString(doc));
@ -2271,15 +2270,13 @@ public class DBMSRecords implements ServletContextAware {
File file = new File(data_dir + "temp" + File.separator + fileName); File file = new File(data_dir + "temp" + File.separator + fileName);
if(file.exists()) if(file.exists())
{ {
//logger.info("Send report: " + fileName);
//response.setContentType("application/octet-stream"); //Commented because it is specified in the function declaration. //response.setContentType("application/octet-stream"); //Commented because it is specified in the function declaration.
response.setHeader("Content-Disposition","attachment; filename="+fileName); response.setHeader("Content-Disposition","attachment; filename="+fileName);
response.setContentLength((int) file.length()); response.setContentLength((int) file.length());
return new FileSystemResource(file); return new FileSystemResource(file);
}else }else
{ {
logger.info("File not found: " + fileName); logger.info("File not found: " + data_dir + "temp" + File.separator + fileName);
return null; return null;
} }
} }

View File

@ -25,13 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.context.ServletContextAware; import org.springframework.web.context.ServletContextAware;
import org.w3c.dom.DOMException; import org.w3c.dom.DOMException;
import org.w3c.dom.Document; import org.w3c.dom.Document;
@ -53,7 +47,12 @@ public class DBMSTree implements ServletContextAware {
@RequestMapping(value = "/tree",method = RequestMethod.POST,produces = "application/xml; charset=utf-8") @RequestMapping(value = "/tree",method = RequestMethod.POST,produces = "application/xml; charset=utf-8")
@ResponseBody @ResponseBody
public Object ajaxTamer(@ModelAttribute User user,@RequestBody byte[] reqData,@RequestParam(required=false,name="lng") String language_id) { public Object ajaxTamer(
@ModelAttribute User user,
@RequestBody byte[] reqData,
//@RequestParam(required=false,name="lng") String language_id
@CookieValue(value = "lng", defaultValue = "3") String language_id
) {
if(language_id!=null && !language_id.equals("")) if(language_id!=null && !language_id.equals(""))
user.language_id=language_id; user.language_id=language_id;

View File

@ -0,0 +1,18 @@
package logging;
import dbms.DBMSRecords;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class JavaLogger implements logging.Logger {
private final Logger logger;
public JavaLogger(Class<?> clazz) {
this.logger = LogManager.getLogger(clazz);
}
public void debug(String msg) { this.logger.debug(msg); }
public void info(String msg) { this.logger.info(msg); }
public void warn(String msg) { this.logger.warn(msg); }
public void error(String msg) { this.logger.error(msg); }
}

View File

@ -0,0 +1,12 @@
package logging;
public interface Logger {
void debug(String msg);
void info(String msg);
void warn(String msg);
void error(String msg);
static Logger getLogger(Class<?> clazz) {
return LoggerFactory.createLogger(clazz); // Подменяется реализацией
}
}

View File

@ -0,0 +1,14 @@
package logging;
import org.apache.logging.slf4j.SLF4JLogger;
public class LoggerFactory {
public static Logger createLogger(Class<?> clazz) {
// Тут выбираешь реализацию по флагу/условию
//if (isAndroid()) {
// return new AndroidLogger(clazz);
//} else {
return new JavaLogger(clazz);
//}
}
}

View File

@ -0,0 +1,113 @@
package models;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
@Schema(
description = "Error API response",
example = "{ \"error_code\": 10000, \"error_message\": [\"Internal_Server_Error\",\"Please_log_in\"], \"error_setting\": [\"99;day\",\"1;2\"], \"error_marker\": \"2a449883-c7c6-468e-b3ae-5f73fc96627d\" }"
)
public class ErrorResponseModel {
@JsonIgnore
private int httpCode;
@Schema(description = "Error code", example = "10000")
@JsonProperty("error_code")
private int errorCode;
@Schema(description = "List of error descriptions", example = "[\"Internal_Server_Error\",\"Please_log_in\"]")
@JsonProperty("error_message")
private List<String> errorMessage;
@Schema(description = "Options for translated text", example = "[\"99;day\",\"1;2\"]")
@JsonProperty("error_setting")
private List<String> errorSetting;
@Schema(description = "Unique identifier for searching in the database", example = "4260aad8-f7ee-4be4-b52c-15d56ec83232")
@JsonProperty("error_marker")
private String errorMarker;
public ErrorResponseModel(int httpCode, int errorCode) {
this.httpCode = httpCode;
this.errorCode = errorCode;
this.errorMessage = null;
this.errorSetting = null;
this.errorMarker = UUID.randomUUID().toString();
}
public ErrorResponseModel(int httpCode, int errorCode, List<String> errorMessage, String errorMarker) {
this.httpCode = httpCode;
this.errorCode = errorCode;
this.errorMessage = errorMessage;
this.errorMarker = errorMarker;
}
public ErrorResponseModel(int httpCode, int errorCode, String errorMessage, String errorMarker) {
this.httpCode = httpCode;
this.errorCode = errorCode;
this.errorMessage = Collections.singletonList(errorMessage);
this.errorMarker = errorMarker;
}
public ErrorResponseModel(int httpCode, int errorCode, String errorMessage, String errorSetting, String errorMarker) {
this.httpCode = httpCode;
this.errorCode = errorCode;
this.errorMessage = Collections.singletonList(errorMessage);
this.errorSetting = Collections.singletonList(errorSetting);
this.errorMarker = errorMarker;
}
public ErrorResponseModel(int httpCode, int errorCode, List<String> errorMessage, List<String> errorSetting, String errorMarker) {
this.httpCode = httpCode;
this.errorCode = errorCode;
this.errorMessage = errorMessage;
this.errorSetting = errorSetting;
this.errorMarker = errorMarker;
}
public int getHttp_code() {
return httpCode;
}
public void setHttp_code(int errorCode) {
this.httpCode = httpCode;
}
public int getError_code() {
return errorCode;
}
public void setError_code(int errorCode) {
this.errorCode = errorCode;
}
public List<String> getError_message() {
return errorMessage;
}
public void setError_message(List<String> errorMessage) {
this.errorMessage = errorMessage;
}
public void setError_setting(List<String> errorSetting) {
this.errorSetting = errorSetting;
}
public List<String> getError_setting() {
return errorSetting;
}
public void setError_marker(String errorMarker) {
this.errorMarker = errorMarker;
}
public String getError_marker() {
return errorMarker;
}
}

View File

@ -1,28 +1,37 @@
package org.ccalm.dbms; package org.ccalm.dbms;
import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.HikariDataSource;
import models.ErrorResponseModel;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MarkerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import java.io.InputStream; import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Controller @Controller
public class MainController { public class MainController {
private static final Logger logger = LoggerFactory.getLogger(MainController.class);
private final NamedParameterJdbcTemplate jdbcTemplate;
private final Environment environment;
private HikariDataSource dataSource; private HikariDataSource dataSource;
@Value("${spring.application.name}") @Value("${spring.application.name}")
@ -32,36 +41,46 @@ public class MainController {
public void DatabaseService(HikariDataSource dataSource) { public void DatabaseService(HikariDataSource dataSource) {
this.dataSource = dataSource; this.dataSource = dataSource;
} }
//---------------------------------------------------------------------------
@Autowired
public MainController(NamedParameterJdbcTemplate jdbcTemplate, HikariDataSource dataSource, Environment environment) {
this.jdbcTemplate = jdbcTemplate;
this.environment = environment;
this.dataSource = dataSource;
}
//---------------------------------------------------------------------------
@RequestMapping(value = "/",method = {RequestMethod.POST,RequestMethod.GET},produces = "application/json;charset=utf-8") @RequestMapping(value = "/",method = {RequestMethod.POST,RequestMethod.GET},produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public ResponseEntity<String> index() { public ResponseEntity<Object> index(
JSONObject json = new JSONObject(); @CookieValue(value = "lng", defaultValue = "1") String language_id
) {
Translation trt = new Translation(language_id,jdbcTemplate);
try { try {
JSONObject json = new JSONObject();
json.put("error_code",0); json.put("error_code",0);
json.put("error_message",""); json.put("error_message","");
json.put("error_marker",(String)null); json.put("error_marker",(String)null);
String buildDate=""; String buildDate="";
//String buildVersion=""; String buildVersion="";
try { try {
InputStream inputStream = MainController.class.getClassLoader().getResourceAsStream("META-INF/build-info.properties"); InputStream inputStream = MainController.class.getClassLoader().getResourceAsStream("META-INF/build-info.properties");
if (inputStream != null) { if (inputStream != null) {
Properties properties = new Properties(); Properties properties = new Properties();
properties.load(inputStream); properties.load(inputStream);
buildDate = properties.getProperty("build.time"); buildDate = properties.getProperty("build.time");
//buildVersion = properties.getProperty("build.version"); buildVersion = properties.getProperty("build.version");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
json.put("build_date",buildDate); json.put("build_date",buildDate);
//json.put("build_version",buildVersion); json.put("version",buildVersion);
json.put("name",application_name); json.put("name",application_name);
//json.put("active_connections",dataSource.getHikariPoolMXBean().getActiveConnections()); //json.put("active_connections",dataSource.getHikariPoolMXBean().getActiveConnections());
//json.put("idle_connections",dataSource.getHikariPoolMXBean().getIdleConnections()); //json.put("idle_connections",dataSource.getHikariPoolMXBean().getIdleConnections());
// Вывод всех зарегистрированных маршрутов в системе // Вывод всех зарегистрированных маршрутов в системе
ApplicationContext context = SpringContext.getApplicationContext(); /*ApplicationContext context = SpringContext.getApplicationContext();
if (context != null) { if (context != null) {
RequestMappingHandlerMapping mapping = context.getBean(RequestMappingHandlerMapping.class); RequestMappingHandlerMapping mapping = context.getBean(RequestMappingHandlerMapping.class);
Set<String> endpoints = mapping.getHandlerMethods().keySet().stream() Set<String> endpoints = mapping.getHandlerMethods().keySet().stream()
@ -69,12 +88,14 @@ public class MainController {
.collect(Collectors.toSet()); .collect(Collectors.toSet());
System.out.println("=== Registered API endpoints ==="); System.out.println("=== Registered API endpoints ===");
endpoints.forEach(System.out::println); endpoints.forEach(System.out::println);
} }*/
} catch (JSONException e) { return new ResponseEntity<>(json.toString(), HttpStatus.OK);
throw new RuntimeException(e); } catch (Exception e) {
String uuid = UUID.randomUUID().toString();
logger.error(MarkerFactory.getMarker(uuid), e.getMessage());
return new ResponseEntity<>(new ErrorResponseModel(500, 10000, trt.trt(false, "Internal_Server_Error"), null, uuid), HttpStatus.INTERNAL_SERVER_ERROR);
} }
return ResponseEntity.ok(json.toString());
} }
} }

View File

@ -0,0 +1,14 @@
package org.ccalm.dbms;
import ch.qos.logback.classic.pattern.ThrowableProxyConverter;
import ch.qos.logback.classic.spi.IThrowableProxy;
import ch.qos.logback.classic.spi.ThrowableProxyUtil;
public class SingleLineThrowableProxyConverter extends ThrowableProxyConverter {
@Override
protected String throwableProxyToString(IThrowableProxy tp) {
if (tp == null) return "";
String stackTrace = ThrowableProxyUtil.asString(tp);
return stackTrace.replace("\r", "").replace("\n", "\\n").replace("\t", " ");
}
}

View File

@ -1,16 +1,23 @@
package org.ccalm.dbms; package org.ccalm.dbms;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MarkerFactory;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.UUID;
@Component @Component
public class SpringContext implements ApplicationContextAware { public class SpringContext implements ApplicationContextAware {
private static final Logger logger = LoggerFactory.getLogger(SpringContext.class);
private static ApplicationContext context; private static ApplicationContext context;
@Override @Override
public void setApplicationContext(ApplicationContext applicationContext) { public void setApplicationContext(ApplicationContext applicationContext) {
context = applicationContext; context = applicationContext;
logger.warn(MarkerFactory.getMarker(UUID.randomUUID().toString()),"App is start");
} }
public static ApplicationContext getApplicationContext() { public static ApplicationContext getApplicationContext() {

View File

@ -0,0 +1,68 @@
package org.ccalm.dbms;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import tools.DBTools;
import org.json.JSONObject;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import java.util.List;
public class Translation {
private static final Logger logger = LogManager.getLogger(Translation.class);
public int language_id;
public NamedParameterJdbcTemplate jdbcTemplate;
Translation(String lng, NamedParameterJdbcTemplate jdbcTemplate){
language_id=1;
switch (lng) {
case "kz":
case "kk":
language_id = 2;
break;
case "en":
language_id = 3;
break;
case "uz":
language_id = 4;
break;
case "ru":
default:
language_id = 1;
break;
}
this.jdbcTemplate = jdbcTemplate;
}
String trt(boolean translate,String text){
if(translate) {
String sql = """
select
translation
from
main._translations
where
del=false
and language_id=:language_id
and identifier=:identifier;
""";
MapSqlParameterSource parameters = new MapSqlParameterSource();
parameters.addValue("language_id", language_id);
parameters.addValue("identifier", text);
List<String> ret = jdbcTemplate.query(sql, parameters, new DBTools.JsonRowMapper());
int i = 0;
for (i = 0; i < ret.size(); i++) {
JSONObject json = new JSONObject(ret.get(i));
text = json.getString("translation");
}
if(i==0){
text = text.replace("_", " ");
}
return text;
}else {
return text;
}
}
}

View File

@ -1,32 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<!-- Please check if the user has access to the directory from which the application is being executed --> <!-- Ваш кастомный conversionRule для single-line исключений -->
<conversionRule conversionWord="exOneLine" converterClass="org.ccalm.dbms.SingleLineThrowableProxyConverter"/>
<property name="LOGS" value="logs" /> <property name="LOGS" value="logs" />
<springProperty scope="context" name="appName" source="spring.application.name"/> <springProperty scope="context" name="appName" source="spring.application.name"/>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOGS}/${appName}.log</file> <file>${LOGS}/${appName}.log</file>
<encoder> <encoder class="net.logstash.logback.encoder.LogstashEncoder">
<pattern>{"timestamp":"%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}","thread":"[%thread]","level":"%level","logger":"%logger{36}","marker":"%X{marker}","message":"%msg"}%n</pattern> <!-- Кастомные имена полей -->
<fieldNames>
<timestamp>timestamp</timestamp> <!-- Без @ -->
<level>level</level>
<message>message</message>
<stack_trace>exception</stack_trace>
<version>[ignore]</version>
<threadName>[ignore]</threadName>
<loggerName>[ignore]</loggerName>
<levelValue>[ignore]</levelValue>
<mdc>[ignore]</mdc>
</fieldNames>
<!-- Формат timestamp -->
<timestampPattern>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</timestampPattern>
<timestampTimeZone>UTC</timestampTimeZone>
<!-- Включаем маркеры (tags для MarkerFactory) -->
<includeTags>true</includeTags>
<!-- Отключаем лишние данные -->
<includeCallerData>false</includeCallerData>
<includeContext>false</includeContext>
<!-- Single-line исключения -->
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<maxDepthPerThrowable>1</maxDepthPerThrowable>
<maxLength>1024</maxLength>
<shortenedClassNameLength>20</shortenedClassNameLength>
<exclude>$$FastClassByCGLIB$$</exclude>
<exclude>$$EnhancerBySpringCGLIB$$</exclude>
</throwableConverter>
</encoder> </encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOGS}/${appName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern> <fileNamePattern>${LOGS}/${appName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>100MB</maxFileSize>
<maxHistory>30</maxHistory> <maxHistory>30</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <totalSizeCap>3GB</totalSizeCap>
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'} | %level | %logger{36} | %X{marker} | %msg%n</pattern> <pattern>
%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'} | %level | %logger{36} | %marker | %msg%n
</pattern>
</encoder> </encoder>
</appender> </appender>
<!--root level="info"--> <root level="info">
<root level="warn">
<appender-ref ref="FILE" /> <appender-ref ref="FILE" />
<appender-ref ref="CONSOLE" /> <appender-ref ref="CONSOLE" />
</root> </root>