Skip to content

Instantly share code, notes, and snippets.

@johnmccabe
Last active December 8, 2015 12:51
Show Gist options
  • Save johnmccabe/09d1e7adba418fa5289b to your computer and use it in GitHub Desktop.
Save johnmccabe/09d1e7adba418fa5289b to your computer and use it in GitHub Desktop.
Brooklyn/Clocker Logback Settings for IntelliJ Run Configurations

By default when you create a Run Configuration for Brooklyn in IntelliJ it logs in full DEBUG mode. You can however override the classpath logback.xml.

Set the following VM Option in your Brooklyn Application Run Configuration, this should be a full path, using ~ doesn't work:

-Dlogback.configurationFile="/full/path/to/logback.xml"

An example logback configuration file is shown below, note that the appenders etc are being pulled from the classpath.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- to supply custom logging, either change this file, supply your own logback-main.xml
(overriding the default provided on the classpath) or any of the files it references;
see the Logging section of the Brooklyn web site for more information -->
<property name="logging.basename" scope="context" value="brooklyn" />
<property name="logging.dir" scope="context" value="./" />
<!-- set default root logger threshhold to info; some categories may get debug -->
<root level="INFO"/>
<!-- if there is any customisation, load it after setting above categories
(so things in custom take priority) but before appenders
(so the properties e.g. log filename set in this file are used) -->
<include resource="logback-custom.xml"/>
<!-- 'FILE' e.g. brooklyn.log gets all messages by default -->
<include resource="brooklyn/logback-appender-file.xml"/>
<!-- 'STDOUT' gets INFO and higher -->
<include resource="brooklyn/logback-appender-stdout.xml"/>
<!-- some loggers are very noisy however, exclude them, or make them file only;
must be declared after the FILE appender above -->
<include resource="brooklyn/logback-logger-excludes.xml"/>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment