Skip to content

Commit

Permalink
Add logback configuration to Cerebro
Browse files Browse the repository at this point in the history
  • Loading branch information
Infra-Red committed Mar 31, 2017
1 parent 5a555a7 commit 6288eb3
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions jobs/cerebro/spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ templates:
bin/cerebro_ctl: bin/cerebro_ctl
bin/monit_debugger: bin/monit_debugger
config/application.conf.erb: config/application.conf
config/logback.xml.erb: config/logback.xml
data/properties.sh.erb: data/properties.sh
helpers/ctl_setup.sh: helpers/ctl_setup.sh
helpers/ctl_utils.sh: helpers/ctl_utils.sh
Expand Down
2 changes: 2 additions & 0 deletions jobs/cerebro/templates/bin/cerebro_ctl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ source /var/vcap/jobs/cerebro/helpers/ctl_setup.sh 'cerebro'
export PORT=${PORT:-5000}
export LANG=en_US.UTF-8

link_job_file_to_package config/logback.xml conf/logback.xml

case $1 in

start)
Expand Down
24 changes: 24 additions & 0 deletions jobs/cerebro/templates/config/logback.xml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<configuration>

<conversionRule conversionWord="coloredLevel" converterClass="play.api.libs.logback.ColoredLevel"/>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%coloredLevel %logger{15} - %message%n%xException{5}</pattern>
</encoder>
</appender>

<logger name="play" level="INFO"/>
<logger name="application" level="INFO"/>

<!-- Off these ones as they are annoying, and anyway we manage configuration ourself -->
<logger name="com.avaje.ebean.config.PropertyMapLoader" level="OFF"/>
<logger name="com.avaje.ebeaninternal.server.core.XmlConfigLoader" level="OFF"/>
<logger name="com.avaje.ebeaninternal.server.lib.BackgroundThread" level="OFF"/>
<logger name="com.gargoylesoftware.htmlunit.javascript" level="OFF"/>

<root level="ERROR">
<appender-ref ref="STDOUT"/>
</root>

</configuration>
2 changes: 2 additions & 0 deletions jobs/cerebro/templates/helpers/ctl_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ JOB_NAME=$1
output_label=${2:-${JOB_NAME}}

export JOB_DIR=/var/vcap/jobs/$JOB_NAME
export PKG_DIR=/var/vcap/packages/$JOB_NAME
chmod 755 $PKG_DIR # to access file via symlink
chmod 755 $JOB_DIR # to access file via symlink

# Load some bosh deployment properties into env vars
Expand Down
2 changes: 1 addition & 1 deletion jobs/cerebro/templates/helpers/ctl_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
link_job_file_to_package() {
source_job_file=$1
target_package_file=${2:-$source_job_file}
full_package_file=$WEBAPP_DIR/${target_package_file}
full_package_file=$PKG_DIR/${target_package_file}

link_job_file ${source_job_file} ${full_package_file}
}
Expand Down

0 comments on commit 6288eb3

Please sign in to comment.