From 51b42c591b2b16a6ec96756cbe97e89668ec2e53 Mon Sep 17 00:00:00 2001 From: Deklan Dieterly Date: Wed, 19 Feb 2014 11:06:14 -0700 Subject: [PATCH] Added logging to mon-persister-config.yml. --- .../java/com/hpcloud/MonPersisterService.java | 1 - .../com/hpcloud/mon-persister-config.yml | 90 ++++++++++++++++++- src/main/resources/log4j.properties | 4 +- 3 files changed, 91 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/hpcloud/MonPersisterService.java b/src/main/java/com/hpcloud/MonPersisterService.java index 81bb3e90..63795328 100644 --- a/src/main/java/com/hpcloud/MonPersisterService.java +++ b/src/main/java/com/hpcloud/MonPersisterService.java @@ -16,7 +16,6 @@ public class MonPersisterService extends Service { @Override public void run(MonPersisterConfiguration configuration, Environment environment) throws Exception { - System.out.println("Hello, my name is " + configuration.getName()); environment.addResource(new Resource()); environment.addHealthCheck(new SimpleHealthCheck("foo")); } diff --git a/src/main/resources/com/hpcloud/mon-persister-config.yml b/src/main/resources/com/hpcloud/mon-persister-config.yml index 189a64cf..19135519 100644 --- a/src/main/resources/com/hpcloud/mon-persister-config.yml +++ b/src/main/resources/com/hpcloud/mon-persister-config.yml @@ -1 +1,89 @@ -name: mon-persister \ No newline at end of file +name: mon-persister + +# Logging settings. +logging: + + # The default level of all loggers. Can be OFF, ERROR, WARN, INFO, + # DEBUG, TRACE, or ALL. + level: INFO + + # Logger-specific levels. + loggers: + + # Sets the level for 'com.example.app' to DEBUG. + com.example.app: DEBUG + + # Settings for logging to stdout. + console: + + # If true, write log statements to stdout. + enabled: true + + # Do not display log statements below this threshold to stdout. + threshold: ALL + + # The time zone in which dates should be displayed. + timeZone: UTC + + # A custom Logback format string. + logFormat: null + + # Settings for logging to a file. + file: + + # If true, write log statements to a file. + enabled: true + + # Do not write log statements below this threshold to the file. + threshold: ALL + + # The time zone in which dates should be displayed. + timeZone: UTC + + # A custom Logback format string. + logFormat: null + + # The file to which statements will be logged. + # + # If enabled is true, this must be specified. + currentLogFilename: ./logs/mon-persister.log + + # If true, log files are rotated and archived. + archive: true + + # When the log file rolls over, the file will be archived to + # app-2012-03-15.log.gz, example.log will be truncated, + # and new statements written to it. + # + # If archive is true, this must be specified. + archivedLogFilenamePattern: ./logs/mon-persister-%d.log.gz + + # The maximum number of log files to archive. + archivedFileCount: 5 + + # Settings for logging to syslog. + syslog: + + # If true, write log statements to syslog. + enabled: false + + # The hostname of the syslog server to which statements will be + # sent. + # + # N.B.: If this is the local host, the local syslog instance + # will need to be configured to listen on an inet socket, not just + # a Unix socket. + host: localhost + + # The syslog facility to which statements will be sent. + # + # Can be one of: {AUTH, AUTHPRIV, DAEMON, CRON, FTP, LPR, KERN, + # MAIL, NEWS, SYSLOG, USER, UUCP, LOCAL0, LOCAL1, LOCAL2, LOCAL3, + # LOCAL4, LOCAL5, LOCAL6, LOCAL7}. + facility: local0 + + # The time zone in which dates should be displayed. + timeZone: UTC + + # A custom Logback format string. + logFormat: null \ No newline at end of file diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties index 182cc100..6c4ed533 100644 --- a/src/main/resources/log4j.properties +++ b/src/main/resources/log4j.properties @@ -1,4 +1,4 @@ -log4j.rootLogger=debug, stdout, R +log4j.rootLogger=info, stdout, R log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout @@ -7,7 +7,7 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n log4j.appender.R=org.apache.log4j.RollingFileAppender -log4j.appender.R.File=kafaTest.log +log4j.appender.R.File=mon-persister.log log4j.appender.R.MaxFileSize=100KB # Keep one backup file