Java 类和对象并且更新 Log4j2 的配置。

This commit is contained in:
YuCheng Hu 2021-04-25 17:04:09 -04:00
parent 575d7c02c0
commit aeafc6f848
3 changed files with 75 additions and 5 deletions

View File

@ -38,6 +38,10 @@
</license>
</licenses>
<modules>
<module>toolkits</module>
</modules>
<properties>
<!-- Generic properties -->
<java.version>11</java.version>
@ -75,8 +79,8 @@
<!-- LOG -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.11.0</version>
<artifactId>log4j-slf4j18-impl</artifactId>
<version>2.14.0</version>
</dependency>
<!-- APACHE COMMONS -->
@ -305,6 +309,7 @@
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>

View File

@ -0,0 +1,64 @@
package com.ossez.toolkits.codebank.tests;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.TestInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Object of VariableOssez
*
* @author YuCheng
*
*/
class OssezVariable {
int s1, s2;
static int s3;
OssezVariable(int x, int y, int z) {
s1 = x;
s2 = y;
s3 = z;
}
}
/**
* @author YuCheng Hu
*/
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class DataStructureTest{
private final static Logger logger = LoggerFactory.getLogger(DataStructureTest.class);
@BeforeAll
protected void setUp() throws Exception {
}
@AfterAll
protected void tearDown() throws Exception {
}
/**
* Do RetsServerConnection Test
*/
@Test
public void testArrayDataStructure() {
int[] intArraySize = new int[3];
Integer intArrayW[] = new Integer[3];
logger.debug("Array Size - [{}]", intArraySize.length);
logger.debug("Array Size - [{}]", intArrayW.length);
int[] intArrayValue = {1,2,3};
String[] strArray = {"COM","OSSEZ","US"};
logger.debug("Array Size - [{}]", intArrayValue.length);
}
}

View File

@ -7,10 +7,11 @@
</Appenders>
<Loggers>
<Logger name="com.ossez" level="trace">
<AppenderRef ref="Console"/>
<AppenderRef ref="Console" />
</Logger>
<Root level="error">
<AppenderRef ref="Console"/>
<Root level="all">
</Root>
</Loggers>
</Configuration>