保存进度!

This commit is contained in:
Kane Wang 2023-06-21 18:47:17 +08:00
parent 8c4293f374
commit 157ab0d76e
3 changed files with 16 additions and 6 deletions

View File

@ -104,7 +104,6 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>2.20.0</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -17,10 +17,14 @@ import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpMethod;
public class CrosFilter implements Filter
{
private static Logger logger = LoggerFactory.getLogger(CrosFilter.class);
@Override
public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain )
throws ServletException, IOException
@ -30,7 +34,7 @@ public class CrosFilter implements Filter
String method = request.getMethod();
String originHeader = request.getHeader( "Origin" );
System.out.println( "收到" + method + "请求,来自" + originHeader);
logger.info( "收到" + method + "请求,来自" + originHeader);
// 如果是Options请求
if ( method.equals(HttpMethod.OPTIONS.toString()) )

View File

@ -1,14 +1,21 @@
<Configuration status="WARN" monitorInterval="300">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} ### %msg%n" />
<ThresholdFilter level="trace" onMatch="ACCEPT" onMismatch="DENY" />
</Console>
<RollingFile name="rolling_file" filename="./logs/app.log"
filePattern="./logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout pattern="%d{yyyy-MM-dd 'at' HH:mm:ss z} %-5level %class{36} %L %M - %msg%xEx%n"/>
<SizeBasedTriggeringPolicy size="50MB" />
<DefaultRolloverStrategy max="20" />
</RollingFile>
</Appenders>
<Loggers>
<Logger name="mylog" level="trace" additivity="false">
<AppenderRef ref="Console" />
<Logger name="mylog" level="info" additivity="false">
<AppenderRef ref="rolling_file" />
</Logger>
<Root level="error">
<Root level="info">
<AppenderRef ref="Console" />
</Root>
</Loggers>