Add logging with log4j. Completes #40
This commit is contained in:
parent
38dec65bf9
commit
f42f714863
7
pom.xml
7
pom.xml
@ -135,9 +135,14 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Logging -->
|
<!-- Logging -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-core</artifactId>
|
||||||
|
<version>2.6.1</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-simple</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
<version>1.7.21</version>
|
<version>1.7.21</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -7,10 +7,6 @@ import io.vertx.ext.dropwizard.DropwizardMetricsOptions;
|
|||||||
final class Main {
|
final class Main {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "error");
|
|
||||||
System.setProperty("org.slf4j.simpleLogger.showDateTime", "true");
|
|
||||||
System.setProperty("org.slf4j.simpleLogger.dateTimeFormat", "h:mm:ss a");
|
|
||||||
System.setProperty("org.slf4j.simpleLogger.showThreadName", "false");
|
|
||||||
System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.SLF4JLogDelegateFactory");
|
System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.SLF4JLogDelegateFactory");
|
||||||
Vertx.vertx(new VertxOptions().setMetricsOptions(
|
Vertx.vertx(new VertxOptions().setMetricsOptions(
|
||||||
new DropwizardMetricsOptions().setEnabled(true).setRegistryName("apiv3-registry")
|
new DropwizardMetricsOptions().setEnabled(true).setRegistryName("apiv3-registry")
|
||||||
|
26
src/main/resources/log4j.xml
Normal file
26
src/main/resources/log4j.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE log4j:configuration PUBLIC "-//log4j/log4j Configuration//EN" "log4j.dtd">
|
||||||
|
|
||||||
|
<log4j:configuration>
|
||||||
|
<appender name="RollingAppender" class="org.apache.log4j.DailyRollingFileAppender">
|
||||||
|
<param name="File" value="log/apiv3.log" />
|
||||||
|
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
||||||
|
<layout class="org.apache.log4j.PatternLayout">
|
||||||
|
<param name="ConversionPattern" value="[%p %d{yyyy-MM-dd HH:mm:ss}] %m%n"/>
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender">
|
||||||
|
<param name="Target" value="System.out"/>
|
||||||
|
<layout class="org.apache.log4j.PatternLayout">
|
||||||
|
<param name="ConversionPattern" value="[%p %d{yyyy-MM-dd HH:mm:ss}] %m%n"/>
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root>
|
||||||
|
<priority value="INFO"/>
|
||||||
|
<appender-ref ref="RollingAppender" />
|
||||||
|
<appender-ref ref="ConsoleAppender" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</log4j:configuration>
|
Loading…
Reference in New Issue
Block a user