Skip to content

Commit

Permalink
[DGPB-1702] Metabase logs are losing in discovery logs (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsostratio authored Jan 9, 2019
1 parent be1bb9d commit eabc997
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 5 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ RUN mkdir -p bin target/uberjar && \
mkdir -p bin /root/.crossdata/
COPY --from=builder /app/source/target/uberjar/metabase.jar /app/target/uberjar/
COPY --from=builder /app/source/bin/start /app/bin/
COPY --from=builder /app/source/resources/log4j2.xml /app/target/log/
COPY --from=builder /root/defaultsecrets/* /root/defaultsecrets/
COPY --from=builder /root/kms/* /root/kms/

Expand Down
9 changes: 8 additions & 1 deletion bin/start
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ if [ "$PORT" ]; then
export MB_JETTY_PORT="$PORT"
fi

source /root/kms/kms_utils.sh
source /root/kms/b-log.sh


source /root/kms/secrets.sh


Expand Down Expand Up @@ -133,6 +137,7 @@ JAVA_OPTS="$JAVA_OPTS -XX:+IgnoreUnrecognizedVMOptions" # Don't barf if we see a
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true" # don't try to start AWT. Not sure this does anything but better safe than wasting memory
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8" # Use UTF-8
JAVA_OPTS="$JAVA_OPTS --add-modules=java.xml.bind" # Enable access to java.xml.bind module (Java 9)
JAVA_OPTS="$JAVA_OPTS -Dlog4j.configuration=target/log/log4j2.xml"

# Heap Size (defaults to 1g min, 95% of the given memory as max)
CURRENT_MEMORY=$MARATHON_APP_RESOURCE_MEM
Expand All @@ -144,6 +149,8 @@ if [ "$JMX" ]; then
JAVA_OPTS="$JAVA_OPTS $JMX"
fi

echo "Using these JAVA_OPTS: ${JAVA_OPTS}"
INFO "Using these JAVA_OPTS: ${JAVA_OPTS}"

INFO "exec java $JAVA_OPTS -jar ./target/uberjar/metabase.jar"

exec java $JAVA_OPTS -jar ./target/uberjar/metabase.jar
4 changes: 0 additions & 4 deletions resources/kms/secrets.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash


source /root/kms/kms_utils.sh
source /root/kms/b-log.sh


TENANT_UNDERSCORE=${TENANT_NAME//-/_}
export TENANT_NORM="${TENANT_UNDERSCORE^^}"

Expand Down
65 changes: 65 additions & 0 deletions resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{MM-dd HH:mm:ss} \u001b[1m%p %c{2}\u001b[0m :: %m%n" />
</Console>

<RollingFile name="File" fileName="${logfile.path}/metabase.log"
filePattern="metabase-%d{yyyy-MM-dd}.%i.log">
<PatternLayout pattern="%d [%t] %-5p%c - %m%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="500 MB" />
</Policies>
</RollingFile>

</Appenders>

<Loggers>

<Logger name="metabase.driver" level="info" additivity="false">
<AppenderRef ref="File" />
<AppenderRef ref="Console" />
</Logger>
<Logger name="metabase.middleware" level="debug" additivity="false">
<AppenderRef ref="File" />
<AppenderRef ref="Console" />
</Logger>

<Logger name="metabase.models.permissions" level="info" additivity="false">
<AppenderRef ref="File" />
<AppenderRef ref="Console" />
</Logger>
<Logger name="metabase.query-processor.permissions" level="info" additivity="false">
<AppenderRef ref="File" />
<AppenderRef ref="Console" />
</Logger>
<Logger name="metabase.query-processor" level="info" additivity="false">
<AppenderRef ref="File" />
<AppenderRef ref="Console" />
</Logger>
<Logger name="metabase.sync" level="info" additivity="false">
<AppenderRef ref="File" />
<AppenderRef ref="Console" />
</Logger>
<Logger name="metabase.models.field-values" level="info" additivity="false">
<AppenderRef ref="File" />
<AppenderRef ref="Console" />
</Logger>
<Logger name="metabase" level="info" additivity="false">
<AppenderRef ref="File" />
<AppenderRef ref="Console" />
</Logger>

<Logger name="com.mchange" level="error" additivity="false">
<AppenderRef ref="File" />
<AppenderRef ref="Console" />
</Logger>

<Root level="WARN">
<AppenderRef ref="Console" />
</Root>

</Loggers>
</Configuration>

0 comments on commit eabc997

Please sign in to comment.