Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GRIFFIN-273] Griffin Service with user-defined log4j2 configuration #518

Closed
wants to merge 13 commits into from
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ measure/src/test/test_scala/*

.vscode

environment.local.ts
environment.local.ts
logs/
18 changes: 18 additions & 0 deletions service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ under the License.
</exclusion>
</exclusions>
</dependency>
<dependency>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
Expand Down Expand Up @@ -147,6 +151,10 @@ under the License.
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -195,6 +203,10 @@ under the License.
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api-2.5</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand All @@ -203,6 +215,12 @@ under the License.
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-client</artifactId>
<version>${confluent.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>

<!--schedule-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class GriffinWebApplication {
.getLogger(GriffinWebApplication.class);

public static void main(String[] args) {
LOGGER.info("application start");
SpringApplication.run(GriffinWebApplication.class, args);
LOGGER.info("application started");
}

@Bean
Expand Down
4 changes: 3 additions & 1 deletion service/src/main/resources/application-dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.schema=classpath:init_quartz_h2.sql
# enable h2 console, default path: http://localhost:8080/h2-console/
spring.h2.console.enabled=true
spring.jpa.show-sql=true
spring.jpa.show-sql=true

logging.file=logs/griffin-service.log
2 changes: 2 additions & 0 deletions service/src/main/resources/application-docker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ livy.task.submit.interval.second=3
livy.task.appId.retry.count=3
# yarn url
yarn.uri=http://10.148.215.23:38088

logging.file=logs/griffin-service.log
2 changes: 2 additions & 0 deletions service/src/main/resources/application-mysql.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ spring.jpa.generate-ddl=true
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update

logging.file=logs/griffin-service.log
4 changes: 3 additions & 1 deletion service/src/main/resources/application-prod.properties
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@ livy.task.max.concurrent.count=20
livy.task.submit.interval.second=3
livy.task.appId.retry.count=3
# yarn url
yarn.uri=http://localhost:8088
yarn.uri=http://localhost:8088

logging.file=logs/griffin-service.log
2 changes: 2 additions & 0 deletions service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@ livy.server.auth.kerberos.keytab=/path/to/livy/keytab/file
yarn.uri=http://localhost:8088
# griffin event listener
internal.event.listeners=GriffinJobEventHook

logging.file=logs/griffin-service.log
43 changes: 43 additions & 0 deletions service/src/main/resources/log4j2-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Properties>
<Property name="PID">????</Property>
<Property name="LOG_EXCEPTION_CONVERSION_WORD">%xwEx</Property>
<Property name="LOG_LEVEL_PATTERN">%5p</Property>
<Property name="CONSOLE_LOG_PATTERN">%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %clr{${LOG_LEVEL_PATTERN}} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%-40.40c{1.}[%L]}{cyan} %clr{:}{faint} %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}</Property>
<Property name="FILE_LOG_PATTERN">%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN} ${sys:PID} --- [%t] %-40.40c{1.}[%L] : %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}</Property>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT" follow="true">
<PatternLayout pattern="${sys:CONSOLE_LOG_PATTERN}" />
</Console>
<RollingFile name="File" fileName="${sys:LOG_FILE}"
filePattern="logs/$${date:yyyy-MM}/application-%d{yyyy-MM-dd-HH}-%i.log.gz">
<PatternLayout>
<Pattern>${sys:FILE_LOG_PATTERN}</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10 MB" />
</Policies>
<DefaultRollOverStrategy max = "10"/>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="org.apache.catalina.startup.DigesterFactory" level="error" />
<Logger name="org.apache.catalina.util.LifecycleBase" level="error" />
<Logger name="org.apache.coyote.http11.Http11NioProtocol" level="warn" />
<logger name="org.apache.sshd.common.util.SecurityUtils" level="warn"/>
<Logger name="org.apache.tomcat.util.net.NioSelectorPool" level="warn" />
<Logger name="org.crsh.plugin" level="warn" />
<logger name="org.crsh.ssh" level="warn"/>
<Logger name="org.eclipse.jetty.util.component.AbstractLifeCycle" level="error" />
<Logger name="org.hibernate.validator.internal.util.Version" level="warn" />
<logger name="org.springframework.boot.actuate.autoconfigure.CrshAutoConfiguration" level="warn"/>
<logger name="org.springframework.boot.actuate.endpoint.jmx" level="warn"/>
<logger name="org.thymeleaf" level="warn"/>
<Root level="info">
<AppenderRef ref="Console" />
<AppenderRef ref="File" />
</Root>
</Loggers>
</Configuration>
2 changes: 2 additions & 0 deletions service/src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ elasticsearch.scheme=http
# elasticsearch.password = password
# griffin event listener
internal.event.listeners=GriffinJobEventHook,GriffinTestJobEventHook

logging.file=logs/griffin-service.log