Added logger

This commit is contained in:
Sergey Karmanov 2020-09-03 23:40:28 +03:00
parent aa3cb630fb
commit dc74a419c9
6 changed files with 50 additions and 2 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ bin
# Ignore MacOS
**/.DS_Store
.idea/
run/

View File

@ -43,3 +43,4 @@ plugins {
* Trove4j
* java-graphics/glm - GLM ported to Java. _Maven Central contains an outdated version, a custom repository used instead_
* Apache Commons Math (_not currently used_)
* log4j

View File

@ -17,7 +17,11 @@ dependencies {
implementation 'ru.windcorp.fork.io.github.java-graphics:glm:1.0.1'
testImplementation 'junit:junit:4.12'
// log4j
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.13.3'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.13.3'
testImplementation 'junit:junit:4.12'
}
/*
@ -70,4 +74,6 @@ dependencies {
runtimeOnly "org.lwjgl:lwjgl-par::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives"
if (lwjglNatives == "natives-macos") runtimeOnly "org.lwjgl:lwjgl-vulkan::$lwjglNatives"
}
}
// LWJGL END

BIN
pictures/jetbrains_ide.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -17,11 +17,17 @@
*******************************************************************************/
package ru.windcorp.progressia.client;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import ru.windcorp.progressia.ProgressiaLauncher;
public class ProgressiaClientMain {
private static final Logger logger = LogManager.getLogger(ProgressiaClientMain.class.getName());
public static void main(String[] args) {
logger.info("App started!");
ProgressiaLauncher.launch(args, new ClientProxy());
}

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Properties>
<Property name="LOG_PATTERN">%d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} %p %m%n</Property>
<Property name="APP_LOG_ROOT">logs</Property>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<RollingFile name="FileLog" fileName="${APP_LOG_ROOT}/game.log"
filePattern="${APP_LOG_ROOT}/game-%d{yyyy-MM-dd}-%i.log">
<LevelRangeFilter minLevel="FATAL" maxLevel="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
<Policies>
<SizeBasedTriggeringPolicy size="18MB" />
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="FileLog" />
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>