35 changed files with 1087 additions and 309 deletions
Binary file not shown.
@ -0,0 +1,33 @@ |
|||||
|
package org.nl.modules.log; |
||||
|
|
||||
|
import org.slf4j.Marker; |
||||
|
import org.slf4j.MarkerFactory; |
||||
|
|
||||
|
public enum LogMarkerTypeEnum { |
||||
|
DEFAULT("default", "默认日志"), |
||||
|
REQUEST("request", "请求日志"), |
||||
|
QUARTZ("quartz", "定时器日志"), |
||||
|
DEVICE_EXECUTE("device_execute", "设备执行日志"), |
||||
|
AGV_TASK_STATUS("agv_task_status", "agv任务状态日志"), |
||||
|
AGV_FEEDBACK_SERVLET("agv_feedback_servlet", "反馈AGV请求"), |
||||
|
AGV_LEAVE_SERVLET("agv_leave_servlet", "AGV请求离开"), |
||||
|
ACS_TO_ERP("acs_to_erp", "ACS请求ERP"), |
||||
|
ACS_TO_WMS("acs_to_wms", "ACS请求WMS"), |
||||
|
AUTO_CREATE_INST("auto_create_inst", "自动创建指令"), |
||||
|
NDC_SOCKET_CONNECTION_AUTORUN("ndc_socket_connection_autorun", "NDC自动连接"), |
||||
|
XZ_AGV_TASK_STATUS("xz_agv_task_status", "仙知AGV指令状态"), |
||||
|
WMS_TO_ACS("wms_to_acs", "WMS下发ACS"); |
||||
|
// 成员变量
|
||||
|
private String name; |
||||
|
private String code; |
||||
|
|
||||
|
// 构造方法
|
||||
|
private LogMarkerTypeEnum(String code, String name) { |
||||
|
this.code = code; |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public static Marker getMarker(LogMarkerTypeEnum logType) { |
||||
|
return MarkerFactory.getMarker(logType.code); |
||||
|
} |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
package org.nl.modules.log; |
||||
|
|
||||
|
import org.slf4j.Marker; |
||||
|
import org.slf4j.MarkerFactory; |
||||
|
|
||||
|
public class LogMarkerUtil { |
||||
|
private static final Marker MARKER = MarkerFactory.getMarker("test_marker"); |
||||
|
|
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
package org.nl.modules.log; |
||||
|
|
||||
|
import ch.qos.logback.classic.spi.ILoggingEvent; |
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import org.bson.Document; |
||||
|
import org.slf4j.Marker; |
||||
|
|
||||
|
import java.net.InetAddress; |
||||
|
import java.net.UnknownHostException; |
||||
|
|
||||
|
/** |
||||
|
* https://www.cnblogs.com/lzghyh/p/14913230.html
|
||||
|
* https://juejin.cn/post/6844903488896385037
|
||||
|
* https://cloud.tencent.com/developer/article/1384035
|
||||
|
* https://www.freesion.com/article/229560377/
|
||||
|
*/ |
||||
|
public class MongoDBAppender extends MongoDBAppenderBase<ILoggingEvent> { |
||||
|
public MongoDBAppender() { |
||||
|
super("loggingEvents"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected Document toMongoDocument(ILoggingEvent eventObject) { |
||||
|
|
||||
|
final Document doc = new Document(); |
||||
|
doc.append("date", DateUtil.now()); |
||||
|
doc.append("source", source); |
||||
|
try { |
||||
|
doc.append("ip", InetAddress.getLocalHost().getHostAddress()); |
||||
|
} catch (UnknownHostException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
Marker marker = eventObject.getMarker(); |
||||
|
if (!ObjectUtil.isEmpty(marker)) { |
||||
|
doc.append("marker", marker.getName()); |
||||
|
}else { |
||||
|
doc.append("marker", "default"); |
||||
|
} |
||||
|
|
||||
|
doc.append("level", eventObject.getLevel().toString()); |
||||
|
doc.append("logger", eventObject.getLoggerName()); |
||||
|
doc.append("thread", eventObject.getThreadName()); |
||||
|
doc.append("message", eventObject.getFormattedMessage()); |
||||
|
if (eventObject.getMDCPropertyMap() != null && !eventObject.getMDCPropertyMap().isEmpty()) |
||||
|
doc.append("mdc", eventObject.getMDCPropertyMap()); |
||||
|
// ...
|
||||
|
return doc; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,109 @@ |
|||||
|
package org.nl.modules.log; |
||||
|
|
||||
|
import ch.qos.logback.classic.spi.ILoggingEvent; |
||||
|
import ch.qos.logback.core.UnsynchronizedAppenderBase; |
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.mongodb.MongoClient; |
||||
|
import com.mongodb.MongoClientOptions; |
||||
|
import com.mongodb.MongoCredential; |
||||
|
import com.mongodb.ServerAddress; |
||||
|
import com.mongodb.client.MongoCollection; |
||||
|
import com.mongodb.client.MongoDatabase; |
||||
|
import lombok.Data; |
||||
|
import org.bson.Document; |
||||
|
import org.slf4j.Marker; |
||||
|
|
||||
|
import java.net.UnknownHostException; |
||||
|
import java.util.Collections; |
||||
|
|
||||
|
/** |
||||
|
* MongoDBAppender适配类 |
||||
|
*/ |
||||
|
@Data |
||||
|
public abstract class MongoDBAppenderBase<E> extends UnsynchronizedAppenderBase<E> { |
||||
|
private MongoClient mongo; |
||||
|
MongoDatabase db; |
||||
|
private MongoCollection<Document> eventsCollection; |
||||
|
|
||||
|
private String host = "127.0.0.1"; // 地址
|
||||
|
private int port = 27017; // 端口号
|
||||
|
private String dbName = "db"; // 库名
|
||||
|
private String collectionName; // 集合名
|
||||
|
private String username; // 用户名
|
||||
|
private String password; // 密码
|
||||
|
protected String source; |
||||
|
|
||||
|
private int connectionsPerHost = 10; // 空闲线程池中最大链接数
|
||||
|
private int threadsAllowedToBlockForConnectionMultiplier = 5; //一个线程等待链接可用的最大等待毫秒数
|
||||
|
private int maxWaitTime = 1000 * 60 * 2; // 最长等待时间
|
||||
|
private int connectTimeout; |
||||
|
private int socketTimeout; |
||||
|
private int wtimeout; |
||||
|
|
||||
|
MongoDBAppenderBase(String collectionName) { |
||||
|
this.collectionName = collectionName; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void start() { |
||||
|
try { |
||||
|
connectToMongoDB(); |
||||
|
super.start(); |
||||
|
} catch (UnknownHostException e) { |
||||
|
addError("Error connecting to MongoDB server: " + host + ":" + port, |
||||
|
e); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void connectToMongoDB() throws UnknownHostException { |
||||
|
// 用户名 数据库 密码
|
||||
|
if (username != null && password != null) { |
||||
|
|
||||
|
MongoCredential credential = MongoCredential.createCredential( |
||||
|
username, dbName, password.toCharArray()); |
||||
|
ServerAddress serverAddress = new ServerAddress(host, port); |
||||
|
mongo = new MongoClient(serverAddress, Collections.singletonList(credential), buildOptions()); |
||||
|
} else { |
||||
|
mongo = new MongoClient(new ServerAddress(host, port), buildOptions()); |
||||
|
} |
||||
|
|
||||
|
db = mongo.getDatabase(dbName); |
||||
|
eventsCollection = db.getCollection(collectionName); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private MongoClientOptions buildOptions() { |
||||
|
final MongoClientOptions.Builder options = new MongoClientOptions.Builder(); |
||||
|
options.connectionsPerHost(connectionsPerHost); |
||||
|
options.threadsAllowedToBlockForConnectionMultiplier(threadsAllowedToBlockForConnectionMultiplier); |
||||
|
options.maxWaitTime(maxWaitTime); |
||||
|
options.connectTimeout(connectTimeout); |
||||
|
options.socketTimeout(socketTimeout); |
||||
|
options.maxWaitTime(wtimeout); |
||||
|
return options.build(); |
||||
|
} |
||||
|
|
||||
|
protected abstract Document toMongoDocument(E event); |
||||
|
|
||||
|
@Override |
||||
|
protected void append(E eventObject) { |
||||
|
if (eventObject instanceof ILoggingEvent) { |
||||
|
ILoggingEvent evt = (ILoggingEvent) eventObject; |
||||
|
Marker marker = evt.getMarker(); |
||||
|
if (ObjectUtil.isEmpty(marker)) |
||||
|
marker = LogMarkerTypeEnum.getMarker(LogMarkerTypeEnum.DEFAULT); |
||||
|
eventsCollection = db.getCollection(marker.getName()); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
eventsCollection.insertOne(toMongoDocument(eventObject)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void stop() { |
||||
|
if (mongo != null) |
||||
|
mongo.close(); |
||||
|
super.stop(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
|
||||
|
package org.nl.modules.log.rest; |
||||
|
|
||||
|
|
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.annotation.Log; |
||||
|
import org.nl.modules.log.service.RootLogService; |
||||
|
import org.springframework.data.domain.Pageable; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author ldjun |
||||
|
* @date 2021-08-19 |
||||
|
**/ |
||||
|
@RestController |
||||
|
@RequiredArgsConstructor |
||||
|
@Api(tags = "系统日志") |
||||
|
@RequestMapping("/api/rootLog") |
||||
|
@Slf4j |
||||
|
public class RootLogController { |
||||
|
|
||||
|
private final RootLogService rootLogService; |
||||
|
|
||||
|
@GetMapping |
||||
|
@Log("查询系统日志") |
||||
|
@ApiOperation("查询系统日志") |
||||
|
//@PreAuthorize("@el.check('point:list')")
|
||||
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) { |
||||
|
return new ResponseEntity<>(rootLogService.queryAll(whereJson, page), HttpStatus.OK); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package org.nl.modules.log.service; |
||||
|
|
||||
|
import org.springframework.data.domain.Pageable; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 系统日志查询 |
||||
|
*/ |
||||
|
public interface RootLogService { |
||||
|
/** |
||||
|
* 查询数据分页 |
||||
|
* @param whereJson 条件 |
||||
|
* @param page 分页参数 |
||||
|
* @return Map<String,Object> |
||||
|
*/ |
||||
|
Map<String,Object> queryAll(Map whereJson, Pageable page); |
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package org.nl.modules.log.service.impl; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.modules.log.service.RootLogService; |
||||
|
import org.springframework.data.domain.Pageable; |
||||
|
import org.springframework.data.mongodb.core.MongoTemplate; |
||||
|
import org.springframework.data.mongodb.core.query.Criteria; |
||||
|
import org.springframework.data.mongodb.core.query.Query; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author ldjun |
||||
|
* @description 服务实现 |
||||
|
* @date 2021-08-19 |
||||
|
**/ |
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
@Slf4j |
||||
|
public class RootLogServiceImpl implements RootLogService { |
||||
|
|
||||
|
private final MongoTemplate mongoTemplate; |
||||
|
|
||||
|
@Override |
||||
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) { |
||||
|
//查询条件
|
||||
|
Query query = Query.query(Criteria.where("level").is("INFO")); |
||||
|
|
||||
|
//根据条件得到的总条数
|
||||
|
long totalSize = mongoTemplate.count(query, Map.class, "log_root"); |
||||
|
|
||||
|
//处理分页
|
||||
|
query.skip(page.getPageNumber()).limit(page.getPageSize()); |
||||
|
List<Map> list = mongoTemplate.find(query, Map.class, "log_root"); |
||||
|
|
||||
|
//封装前端分页查询结果
|
||||
|
JSONObject result = new JSONObject(); |
||||
|
result.put("content", list); |
||||
|
result.put("totalElements", totalSize); |
||||
|
|
||||
|
mongoTemplate.findById("",null,null); |
||||
|
return result; |
||||
|
} |
||||
|
} |
@ -1,32 +1,17 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||
<included> |
<included> |
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
||||
<property name="LOG_HOME" value="${logPath}"/> |
<appender name="acs_to_erp" class="org.nl.modules.log.MongoDBAppender"> |
||||
<!-- 按照每天生成日志文件 --> |
<dbName>acs_log</dbName> |
||||
<appender name="FILE7" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
<collectionName>acs_to_erp</collectionName> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
<source>${CONTEXT_NAME}</source> |
||||
<!--日志文件输出的文件名--> |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
<FileNamePattern>${LOG_HOME}/ACS请求ERP/%d{yyyy-MM-dd}.%i.log</FileNamePattern> |
<level>info</level> |
||||
<!--日志文件保留天数--> |
</filter> |
||||
<maxHistory>15</maxHistory> |
|
||||
<!--单个日志最大容量 至少10MB才能看得出来--> |
|
||||
<maxFileSize>200MB</maxFileSize> |
|
||||
<!--所有日志最多占多大容量--> |
|
||||
<totalSizeCap>20GB</totalSizeCap> |
|
||||
</rollingPolicy> |
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|
||||
</encoder> |
|
||||
|
|
||||
</appender> |
</appender> |
||||
|
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE3"/> |
|
||||
</logger>--> |
|
||||
|
|
||||
<!-- 打印sql --> |
<!-- 打印sql --> |
||||
<logger name=" org.nl.acs.ext.erp.service.impl.AcsToErpServiceImpl" level="info" additivity="false"> |
<logger name=" org.nl.acs.ext.erp.service.impl.AcsToErpServiceImpl" level="info" additivity="false"> |
||||
<appender-ref ref="FILE7"/> |
<appender-ref ref="acs_to_erp"/> |
||||
</logger> |
</logger> |
||||
</included> |
</included> |
||||
|
@ -1,32 +1,17 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||
<included> |
<included> |
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
||||
<property name="LOG_HOME" value="${logPath}"/> |
<appender name="acs_to_wms" class="org.nl.modules.log.MongoDBAppender"> |
||||
<!-- 按照每天生成日志文件 --> |
<dbName>acs_log</dbName> |
||||
<appender name="FILE8" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
<collectionName>acs_to_wms</collectionName> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
<source>${CONTEXT_NAME}</source> |
||||
<!--日志文件输出的文件名--> |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
<FileNamePattern>${LOG_HOME}/ACS请求WMS/%d{yyyy-MM-dd}.%i.log</FileNamePattern> |
<level>info</level> |
||||
<!--日志文件保留天数--> |
</filter> |
||||
<maxHistory>15</maxHistory> |
|
||||
<!--单个日志最大容量 至少10MB才能看得出来--> |
|
||||
<maxFileSize>200MB</maxFileSize> |
|
||||
<!--所有日志最多占多大容量--> |
|
||||
<totalSizeCap>20GB</totalSizeCap> |
|
||||
</rollingPolicy> |
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|
||||
</encoder> |
|
||||
|
|
||||
</appender> |
</appender> |
||||
|
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE3"/> |
|
||||
</logger>--> |
|
||||
|
|
||||
<!-- 打印sql --> |
<!-- 打印sql --> |
||||
<logger name="org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl" level="info" additivity="false"> |
<logger name="org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl" level="info" additivity="false"> |
||||
<appender-ref ref="FILE8"/> |
<appender-ref ref="acs_to_wms"/> |
||||
</logger> |
</logger> |
||||
</included> |
</included> |
||||
|
@ -0,0 +1,16 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<included> |
||||
|
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
||||
|
<appender name="agv_feedback_servlet" class="org.nl.modules.log.MongoDBAppender"> |
||||
|
<dbName>acs_log</dbName> |
||||
|
<collectionName>agv_feedback_servlet</collectionName> |
||||
|
<source>${CONTEXT_NAME}</source> |
||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
|
<level>info</level> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
<!-- 打印sql --> |
||||
|
<logger name="org.nl.acs.agv.server.impl.AgvServiceImpl" level="info" additivity="false"> |
||||
|
<appender-ref ref="agv_feedback_servlet"/> |
||||
|
</logger> |
||||
|
</included> |
@ -0,0 +1,18 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<included> |
||||
|
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
||||
|
<appender name="agv_leave_servlet" class="org.nl.modules.log.MongoDBAppender"> |
||||
|
<dbName>acs_log</dbName> |
||||
|
<collectionName>agv_leave_servlet</collectionName> |
||||
|
<source>${CONTEXT_NAME}</source> |
||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
|
<level>info</level> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 打印sql --> |
||||
|
<logger name="org.nl.acs.device_driver.electric_fence.ItemProtocol" level="info" additivity="false"> |
||||
|
<appender-ref ref="agv_leave_servlet"/> |
||||
|
</logger> |
||||
|
|
||||
|
</included> |
@ -1,32 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<included> |
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
|
||||
<property name="LOG_HOME" value="${logPath}"/> |
|
||||
<!-- 按照每天生成日志文件 --> |
|
||||
<appender name="FILE5" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
|
||||
<!--日志文件输出的文件名--> |
|
||||
<FileNamePattern>${LOG_HOME}/反馈AGV请求/%d{yyyy-MM-dd}.%i.log</FileNamePattern> |
|
||||
<!--日志文件保留天数--> |
|
||||
<maxHistory>15</maxHistory> |
|
||||
<!--单个日志最大容量 至少10MB才能看得出来--> |
|
||||
<maxFileSize>200MB</maxFileSize> |
|
||||
<!--所有日志最多占多大容量--> |
|
||||
<totalSizeCap>20GB</totalSizeCap> |
|
||||
</rollingPolicy> |
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|
||||
</encoder> |
|
||||
|
|
||||
</appender> |
|
||||
|
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE3"/> |
|
||||
</logger>--> |
|
||||
|
|
||||
<!-- 打印sql --> |
|
||||
<logger name="org.nl.acs.agv.server.impl.AgvServiceImpl" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE5"/> |
|
||||
</logger> |
|
||||
</included> |
|
@ -1,32 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<included> |
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
|
||||
<property name="LOG_HOME" value="${logPath}"/> |
|
||||
<!-- 按照每天生成日志文件 --> |
|
||||
<appender name="FILE6" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
|
||||
<!--日志文件输出的文件名--> |
|
||||
<FileNamePattern>${LOG_HOME}/AGV请求离开/%d{yyyy-MM-dd}.%i.log</FileNamePattern> |
|
||||
<!--日志文件保留天数--> |
|
||||
<maxHistory>15</maxHistory> |
|
||||
<!--单个日志最大容量 至少10MB才能看得出来--> |
|
||||
<maxFileSize>200MB</maxFileSize> |
|
||||
<!--所有日志最多占多大容量--> |
|
||||
<totalSizeCap>20GB</totalSizeCap> |
|
||||
</rollingPolicy> |
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|
||||
</encoder> |
|
||||
|
|
||||
</appender> |
|
||||
|
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE3"/> |
|
||||
</logger>--> |
|
||||
|
|
||||
<!-- 打印sql --> |
|
||||
<logger name="org.nl.acs.device_driver.magic_agv.AgvackServlet" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE6"/> |
|
||||
</logger> |
|
||||
</included> |
|
@ -1,31 +1,16 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||
<included> |
<included> |
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
||||
<property name="LOG_HOME" value="${logPath}"/> |
<appender name="auto_create_inst" class="org.nl.modules.log.MongoDBAppender"> |
||||
<!-- 按照每天生成日志文件 --> |
<dbName>acs_log</dbName> |
||||
<appender name="FILE3" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
<collectionName>auto_create_inst</collectionName> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
<source>${CONTEXT_NAME}</source> |
||||
<!--日志文件输出的文件名--> |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
<FileNamePattern>${LOG_HOME}/自动创建指令/%d{yyyy-MM-dd}.%i.log</FileNamePattern> |
<level>info</level> |
||||
<!--日志文件保留天数--> |
</filter> |
||||
<maxHistory>15</maxHistory> |
|
||||
<!--单个日志最大容量 至少10MB才能看得出来--> |
|
||||
<maxFileSize>200MB</maxFileSize> |
|
||||
<!--所有日志最多占多大容量--> |
|
||||
<totalSizeCap>20GB</totalSizeCap> |
|
||||
</rollingPolicy> |
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|
||||
</encoder> |
|
||||
</appender> |
</appender> |
||||
|
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE3"/> |
|
||||
</logger>--> |
|
||||
|
|
||||
<!-- 打印sql --> |
<!-- 打印sql --> |
||||
<logger name="org.nl.modules.quartz.task.AutoCreateInst" level="info" additivity="false"> |
<logger name="org.nl.modules.quartz.task1.AutoCreateInst" level="info" additivity="false"> |
||||
<appender-ref ref="FILE3"/> |
<appender-ref ref="auto_create_inst"/> |
||||
</logger> |
</logger> |
||||
</included> |
</included> |
||||
|
@ -1,32 +1,17 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||
<included> |
<included> |
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
||||
<property name="LOG_HOME" value="${logPath}"/> |
<appender name="ndc_socket_connection_autorun" class="org.nl.modules.log.MongoDBAppender"> |
||||
<!-- 按照每天生成日志文件 --> |
<dbName>acs_log</dbName> |
||||
<appender name="FILE10" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
<collectionName>ndc_socket_connection_autorun</collectionName> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
<source>${CONTEXT_NAME}</source> |
||||
<!--日志文件输出的文件名--> |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
<FileNamePattern>${LOG_HOME}/NDC/%d{yyyy-MM-dd}.%i.log</FileNamePattern> |
<level>info</level> |
||||
<!--日志文件保留天数--> |
</filter> |
||||
<maxHistory>15</maxHistory> |
|
||||
<!--单个日志最大容量 至少10MB才能看得出来--> |
|
||||
<maxFileSize>200MB</maxFileSize> |
|
||||
<!--所有日志最多占多大容量--> |
|
||||
<totalSizeCap>20GB</totalSizeCap> |
|
||||
</rollingPolicy> |
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|
||||
</encoder> |
|
||||
|
|
||||
</appender> |
</appender> |
||||
|
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE3"/> |
|
||||
</logger>--> |
|
||||
|
|
||||
<!-- 打印sql --> |
<!-- 打印sql --> |
||||
<logger name="org.nl.start.auto.run.NDCSocketConnectionAutoRun" level="info" additivity="false"> |
<logger name="org.nl.start.auto.run.NDCSocketConnectionAutoRun" level="info" additivity="false"> |
||||
<appender-ref ref="FILE10"/> |
<appender-ref ref="ndc_socket_connection_autorun"/> |
||||
</logger> |
</logger> |
||||
</included> |
</included> |
||||
|
@ -1,32 +1,15 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||
<included> |
<included> |
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
||||
<property name="LOG_HOME" value="${logPath}"/> |
<appender name="agv_task_status" class="org.nl.modules.log.MongoDBAppender"> |
||||
<!-- 按照每天生成日志文件 --> |
<dbName>acs_log</dbName> |
||||
<appender name="FILE4" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
<collectionName>agv_task_status</collectionName> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
<source>${CONTEXT_NAME}</source> |
||||
<!--日志文件输出的文件名--> |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
<FileNamePattern>${LOG_HOME}/查询AGV指令状态/%d{yyyy-MM-dd}.%i.log</FileNamePattern> |
<level>info</level> |
||||
<!--日志文件保留天数--> |
</filter> |
||||
<maxHistory>15</maxHistory> |
|
||||
<!--单个日志最大容量 至少10MB才能看得出来--> |
|
||||
<maxFileSize>200MB</maxFileSize> |
|
||||
<!--所有日志最多占多大容量--> |
|
||||
<totalSizeCap>20GB</totalSizeCap> |
|
||||
</rollingPolicy> |
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|
||||
</encoder> |
|
||||
|
|
||||
</appender> |
</appender> |
||||
|
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE3"/> |
|
||||
</logger>--> |
|
||||
|
|
||||
<!-- 打印sql --> |
|
||||
<logger name="org.nl.modules.quartz.task.QueryMagicAgvTaskStatus" level="info" additivity="false"> |
<logger name="org.nl.modules.quartz.task.QueryMagicAgvTaskStatus" level="info" additivity="false"> |
||||
<appender-ref ref="FILE4"/> |
<appender-ref ref="agv_task_status"/> |
||||
</logger> |
</logger> |
||||
</included> |
</included> |
||||
|
@ -1,32 +1,15 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||
<included> |
<included> |
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
||||
<property name="LOG_HOME" value="${logPath}"/> |
<appender name="xz_agv_task_status" class="org.nl.modules.log.MongoDBAppender"> |
||||
<!-- 按照每天生成日志文件 --> |
<dbName>acs_log</dbName> |
||||
<appender name="FILE10" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
<collectionName>xz_agv_task_status</collectionName> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
<source>${CONTEXT_NAME}</source> |
||||
<!--日志文件输出的文件名--> |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
<FileNamePattern>${LOG_HOME}/查询仙知AGV指令状态/%d{yyyy-MM-dd}.%i.log</FileNamePattern> |
<level>info</level> |
||||
<!--日志文件保留天数--> |
</filter> |
||||
<maxHistory>15</maxHistory> |
|
||||
<!--单个日志最大容量 至少10MB才能看得出来--> |
|
||||
<maxFileSize>200MB</maxFileSize> |
|
||||
<!--所有日志最多占多大容量--> |
|
||||
<totalSizeCap>20GB</totalSizeCap> |
|
||||
</rollingPolicy> |
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|
||||
</encoder> |
|
||||
|
|
||||
</appender> |
</appender> |
||||
|
<logger name="org.nl.modules.quartz.task1.QueryXZAgvTaskStatus" level="info" additivity="false"> |
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false"> |
<appender-ref ref="xz_agv_task_status"/> |
||||
<appender-ref ref="FILE3"/> |
|
||||
</logger>--> |
|
||||
|
|
||||
<!-- 打印sql --> |
|
||||
<logger name="org.nl.modules.quartz.task.QueryXZAgvTaskStatus" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE10"/> |
|
||||
</logger> |
</logger> |
||||
</included> |
</included> |
||||
|
@ -1,32 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<included> |
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
|
||||
<property name="LOG_HOME" value="${logPath}"/> |
|
||||
<!-- 按照每天生成日志文件 --> |
|
||||
<appender name="FILE11" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
|
||||
<!--日志文件输出的文件名--> |
|
||||
<FileNamePattern>${LOG_HOME}/扫码记录/%d{yyyy-MM-dd}.%i.log</FileNamePattern> |
|
||||
<!--日志文件保留天数--> |
|
||||
<maxHistory>15</maxHistory> |
|
||||
<!--单个日志最大容量 至少10MB才能看得出来--> |
|
||||
<maxFileSize>200MB</maxFileSize> |
|
||||
<!--所有日志最多占多大容量--> |
|
||||
<totalSizeCap>20GB</totalSizeCap> |
|
||||
</rollingPolicy> |
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|
||||
</encoder> |
|
||||
|
|
||||
</appender> |
|
||||
|
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE3"/> |
|
||||
</logger>--> |
|
||||
|
|
||||
<!-- 打印sql --> |
|
||||
<logger name="org.nl.acs.device_driver.standard_scanner.StandardScannerDeviceDriver" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE11"/> |
|
||||
</logger> |
|
||||
</included> |
|
@ -1,32 +1,19 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||
<included> |
<included> |
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
||||
<property name="LOG_HOME" value="${logPath}"/> |
<appender name="wms_to_acs" class="org.nl.modules.log.MongoDBAppender"> |
||||
<!-- 按照每天生成日志文件 --> |
<dbName>acs_log</dbName> |
||||
<appender name="FILE9" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
<collectionName>wms_to_acs</collectionName> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
<source>${CONTEXT_NAME}</source> |
||||
<!--日志文件输出的文件名--> |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
<FileNamePattern>${LOG_HOME}/WMS下发ACS/%d{yyyy-MM-dd}.%i.log</FileNamePattern> |
<level>info</level> |
||||
<!--日志文件保留天数--> |
</filter> |
||||
<maxHistory>15</maxHistory> |
|
||||
<!--单个日志最大容量 至少10MB才能看得出来--> |
|
||||
<maxFileSize>200MB</maxFileSize> |
|
||||
<!--所有日志最多占多大容量--> |
|
||||
<totalSizeCap>20GB</totalSizeCap> |
|
||||
</rollingPolicy> |
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|
||||
</encoder> |
|
||||
|
|
||||
</appender> |
</appender> |
||||
|
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false"> |
|
||||
<appender-ref ref="FILE3"/> |
|
||||
</logger>--> |
|
||||
|
|
||||
<!-- 打印sql --> |
<!-- 打印sql --> |
||||
<logger name="org.nl.acs.ext.wms.service.impl.WmsToAcsServiceImpl" level="info" additivity="false"> |
<logger name="org.nl.acs.ext.wms.service.impl.WmsToAcsServiceImpl" level="info" additivity="false"> |
||||
<appender-ref ref="FILE9"/> |
<appender-ref ref="wms_to_acs"/> |
||||
</logger> |
</logger> |
||||
|
<!--<logger name="org.nl.acs.device_driver.electric_fence.ItemProtocol" level="info" additivity="false"> |
||||
|
<appender-ref ref="wms_to_acs"/> |
||||
|
</logger>--> |
||||
</included> |
</included> |
||||
|
Loading…
Reference in new issue