日志组件

This commit is contained in:
cheney
2022-09-02 16:10:38 +08:00
parent c6d6a200cc
commit 79c0a318a5
4 changed files with 218 additions and 4 deletions
+36 -4
View File
@@ -1,14 +1,46 @@
package test;
import com.sunyard.sge.database.SydApi;
import com.sunyard.sge.database.SydApi4Database;
import com.sunyard.sge.log.LogFactory;
import com.sunyard.sge.log.SydLogFactory;
import com.sunyard.sge.log.SydLogger;
import org.apache.logging.log4j.Logger;
import java.util.Arrays;
import org.junit.Test;
public class LogTest {
@Test
public void case1() throws InterruptedException {
int max = 10000;
int nThread = 10;
Thread[] threads = new Thread[nThread];
for (int i = 0; i < nThread; i++) {
threads[i] = new Thread(new Runnable() {
@Override
public void run() {
SydLogger logger = SydLogFactory.getLogger();
for (int i = 0; i < max; i++) {
logger.debug("tttttttttttttttt");
}
}
});
threads[i].start();
}
for (Thread t : threads) {
try {
t.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Thread.sleep(10000 );
System.out.println("over");
}
public static void main(String[] args) {
Logger log = LogFactory.createLogger("./test-log/", 3);
log.error("error");