Skip to content

Commit

Permalink
add log 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
madneal committed Nov 17, 2017
1 parent 4c8b545 commit 1413286
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ target
out
.idea
index
logs
Binary file added lib/logback-classic-1.2.3.jar
Binary file not shown.
Binary file added lib/logback-core-1.2.3.jar
Binary file not shown.
Binary file added lib/slf4j-api-1.7.25.jar
Binary file not shown.
6 changes: 5 additions & 1 deletion search/src/main/java/file/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileInputStream;
Expand All @@ -23,6 +25,7 @@

public class FileUtil {

final static Logger logger = LoggerFactory.getLogger(FileUtil.class);
public static List<FileBean> getFolderFiles(String path) {
List<FileBean> fileBeans = new ArrayList<FileBean>();
File file = new File(path);
Expand All @@ -35,12 +38,13 @@ public static List<FileBean> getFolderFiles(String path) {
}
} else {
if (CommonConstants.DOCFILES.contains(extName)) {
// logger.error("Scan file" + path);
System.out.println("Scan file:" + path);
fileBeans.add(getFilebean(file));
}
}
} catch (Exception e) {
e.printStackTrace();
logger.error("", e);
}
return fileBeans;
}
Expand Down
Binary file modified search/target/classes/file/FileUtil.class
Binary file not shown.
22 changes: 22 additions & 0 deletions ui/src/main/java/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">
<timestamp key="timestamp-by-second" datePattern="yyyyMMdd'T'HHmmss"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoder 默认配置为PatternLayoutEncoder -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>logs/test-${timestamp-by-second}.log</file>
<append>true</append>
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n
</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>

0 comments on commit 1413286

Please sign in to comment.