alter logging module, add logging-api and logging-impl-log4j2.
fix storage module use log incorrectly.
This commit is contained in:
parent
bf5eb1398a
commit
55dc88f185
|
|
@ -8,21 +8,13 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>skywalking-logging</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>skywalking-logging</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<modules>
|
||||
<module>skywalking-logging-api</module>
|
||||
<module>skywalking-logging-log4j-impl</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>skywalking-logging</artifactId>
|
||||
<groupId>com.a.eye</groupId>
|
||||
<version>2.0-2016</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>skywalking-logging-api</artifactId>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.a.eye.skywalking.logging;
|
||||
package com.a.eye.skywalking.logging.api;
|
||||
|
||||
/**
|
||||
* Created by xin on 2016/11/10.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.a.eye.skywalking.logging;
|
||||
package com.a.eye.skywalking.logging.api;
|
||||
|
||||
/**
|
||||
* Created by xin on 2016/11/10.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.a.eye.skywalking.logging;
|
||||
package com.a.eye.skywalking.logging.api;
|
||||
|
||||
/**
|
||||
* Created by xin on 2016/11/10.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.a.eye.skywalking.logging;
|
||||
package com.a.eye.skywalking.logging.api;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>skywalking-logging</artifactId>
|
||||
<groupId>com.a.eye</groupId>
|
||||
<version>2.0-2016</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>skywalking-logging-log4j-impl</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.a.eye</groupId>
|
||||
<artifactId>skywalking-logging-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.4.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.a.eye.skywalking.logging.impl.log4j2;
|
||||
|
||||
import com.a.eye.skywalking.logging.api.ILog;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Created by wusheng on 2016/11/11.
|
||||
*/
|
||||
public class Log4j2Logger implements ILog {
|
||||
private Logger logger;
|
||||
|
||||
public Log4j2Logger(Logger logger) {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(String message) {
|
||||
logger.info(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(String message, Object... arguments) {
|
||||
logger.info(message, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String message, Throwable e) {
|
||||
logger.error(message, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String message, Object argument, Throwable e) {
|
||||
logger.error(message, argument, e);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.a.eye.skywalking.logging.impl.log4j2;
|
||||
|
||||
import com.a.eye.skywalking.logging.api.ILog;
|
||||
import com.a.eye.skywalking.logging.api.LogResolver;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
/**
|
||||
* Created by wusheng on 2016/11/11.
|
||||
*/
|
||||
public class Log4j2Resolver implements LogResolver {
|
||||
@Override
|
||||
public ILog getLogger(Class<?> clazz) {
|
||||
return new Log4j2Logger(LogManager.getLogger(clazz));
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.a.eye</groupId>
|
||||
<artifactId>skywalking-logging</artifactId>
|
||||
<artifactId>skywalking-logging-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.a.eye.skywalking.registry.impl.zookeeper;
|
||||
|
||||
import com.a.eye.skywalking.logging.ILog;
|
||||
import com.a.eye.skywalking.logging.LogManager;
|
||||
import com.a.eye.skywalking.logging.api.ILog;
|
||||
import com.a.eye.skywalking.logging.api.LogManager;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.a.eye.skywalking.registry.impl.zookeeper;
|
||||
|
||||
import com.a.eye.skywalking.logging.ILog;
|
||||
import com.a.eye.skywalking.logging.LogManager;
|
||||
import com.a.eye.skywalking.logging.api.ILog;
|
||||
import com.a.eye.skywalking.logging.api.LogManager;
|
||||
import com.a.eye.skywalking.registry.api.*;
|
||||
import org.apache.zookeeper.*;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,21 +16,15 @@
|
|||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
<groupId>com.a.eye</groupId>
|
||||
<artifactId>skywalking-network</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.a.eye</groupId>
|
||||
<artifactId>skywalking-registry</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
|
|
@ -41,6 +35,13 @@
|
|||
<artifactId>data-carrier</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.a.eye.skywalking.storage.block.index;
|
||||
|
||||
import com.a.eye.skywalking.logging.api.ILog;
|
||||
import com.a.eye.skywalking.logging.api.LogManager;
|
||||
import com.a.eye.skywalking.storage.block.index.exception.BlockIndexPersistenceFailedException;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -14,7 +14,7 @@ import static com.a.eye.skywalking.storage.config.Config.BlockIndex.STORAGE_BASE
|
|||
|
||||
public class BlockIndexUpdator {
|
||||
|
||||
private static Logger logger = LogManager.getLogger(BlockIndexUpdator.class);
|
||||
private static ILog logger = LogManager.getLogger(BlockIndexUpdator.class);
|
||||
private L1Cache l1Cache;
|
||||
private L2Cache l2Cache;
|
||||
|
||||
|
|
@ -64,8 +64,7 @@ public class BlockIndexUpdator {
|
|||
List<Long> indexData = new ArrayList<>();
|
||||
BufferedReader indexFileReader = null;
|
||||
try {
|
||||
indexFileReader =
|
||||
new BufferedReader(new FileReader(new File(STORAGE_BASE_PATH, DATA_FILE_INDEX_FILE_NAME)));
|
||||
indexFileReader = new BufferedReader(new FileReader(new File(STORAGE_BASE_PATH, DATA_FILE_INDEX_FILE_NAME)));
|
||||
String indexDataStr = null;
|
||||
while ((indexDataStr = indexFileReader.readLine()) != null) {
|
||||
indexData.add(Long.parseLong(indexDataStr));
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.a.eye.skywalking.storage.block.index;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import com.a.eye.skywalking.logging.api.ILog;
|
||||
import com.a.eye.skywalking.logging.api.LogManager;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
|
|
@ -11,13 +11,13 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|||
|
||||
/**
|
||||
* 块索引的一级缓存
|
||||
*
|
||||
* <p>
|
||||
* Created by xin on 2016/11/2.
|
||||
*/
|
||||
public class L1Cache {
|
||||
|
||||
private static final int MAX_DATA_KEEP_SIZE = 30;
|
||||
private static Logger logger = LogManager.getLogger(L1Cache.class);
|
||||
private static ILog logger = LogManager.getLogger(L1Cache.class);
|
||||
private TreeSet<Long> cacheData = new TreeSet<Long>();
|
||||
private final ReadWriteLock updateLock = new ReentrantReadWriteLock();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
package com.a.eye.skywalking.storage.data;
|
||||
|
||||
import com.a.eye.skywalking.logging.api.ILog;
|
||||
import com.a.eye.skywalking.logging.api.LogManager;
|
||||
import com.a.eye.skywalking.storage.block.index.BlockIndexEngine;
|
||||
import com.a.eye.skywalking.storage.data.index.IndexDBConnector;
|
||||
import org.apache.jute.Index;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
|
@ -16,7 +15,7 @@ import static com.a.eye.skywalking.storage.config.Config.DataIndex.MAX_CAPACITY_
|
|||
*/
|
||||
public class IndexDataCapacityMonitor extends Thread {
|
||||
|
||||
private static Logger logger = LogManager.getLogger(IndexDataCapacityMonitor.class);
|
||||
private static ILog logger = LogManager.getLogger(IndexDataCapacityMonitor.class);
|
||||
private static Detector detector;
|
||||
|
||||
public static void addIndexData(long timestamp, int size) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue