Merge lp:~brad-marshall/charms/trusty/thruk-master/add-debug-options into lp:~canonical-bootstack/charms/trusty/thruk-master/trunk

Proposed by Brad Marshall
Status: Merged
Merged at revision: 22
Proposed branch: lp:~brad-marshall/charms/trusty/thruk-master/add-debug-options
Merge into: lp:~canonical-bootstack/charms/trusty/thruk-master/trunk
Diff against target: 96 lines (+67/-0)
3 files modified
config.yaml (+21/-0)
hooks/services.py (+4/-0)
templates/log4perl.conf (+42/-0)
To merge this branch: bzr merge lp:~brad-marshall/charms/trusty/thruk-master/add-debug-options
Reviewer Review Type Date Requested Status
James Hebden (community) Approve
Review via email: mp+269595@code.launchpad.net

Description of the change

Add debug options, and configurable thruk logging paths.

To post a comment you must log in.
Revision history for this message
Peter Sabaini (peter-sabaini) wrote :

lgtm fwiw

Revision history for this message
James Hebden (ec0) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config.yaml'
--- config.yaml 2015-05-05 04:47:26 +0000
+++ config.yaml 2015-08-31 04:51:15 +0000
@@ -34,4 +34,25 @@
3434
35 If you're running multiple environments with the same services in them35 If you're running multiple environments with the same services in them
36 this allows you to differentiate between them.36 this allows you to differentiate between them.
37 log-path:
38 default: "/var/log/thruk/thruk.log"
39 type: string
40 description: >
41 The default log path.
42 debug-log:
43 default: false
44 type: boolean
45 description: >
46 Enables debug logging for thruk.
47 debug-log-path:
48 default: "/var/log/thruk/debug.log"
49 type: string
50 description: >
51 The default log path for debugging (if enabled).
52 screen-log:
53 default: false
54 type: boolean
55 description: >
56 Enables debug logging to stderr for thruk - in the default case, this ends
57 up in the apache error logs.
3758
3859
=== modified file 'hooks/services.py'
--- hooks/services.py 2015-06-24 00:14:14 +0000
+++ hooks/services.py 2015-08-31 04:51:15 +0000
@@ -23,11 +23,15 @@
23 # e.g.: helpers.RequiredConfig('domain', 'auth_key'),23 # e.g.: helpers.RequiredConfig('domain', 'auth_key'),
24 # helpers.MysqlRelation(),24 # helpers.MysqlRelation(),
25 thruk_helpers.ThrukMasterRelation(),25 thruk_helpers.ThrukMasterRelation(),
26 helpers.RequiredConfig(),
26 ],27 ],
27 'data_ready': [28 'data_ready': [
28 helpers.render_template(29 helpers.render_template(
29 source='thruk_local.conf',30 source='thruk_local.conf',
30 target='/etc/thruk/thruk_local.conf'),31 target='/etc/thruk/thruk_local.conf'),
32 helpers.render_template(
33 source='log4perl.conf',
34 target='/etc/thruk/log4perl.conf'),
31 actions.log_start,35 actions.log_start,
32 actions.update_ppa,36 actions.update_ppa,
33 actions.thruk_set_password,37 actions.thruk_set_password,
3438
=== added file 'templates/log4perl.conf'
--- templates/log4perl.conf 1970-01-01 00:00:00 +0000
+++ templates/log4perl.conf 2015-08-31 04:51:15 +0000
@@ -0,0 +1,42 @@
1################################
2## Logging Configuration
3#
4# see http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4perl/Config.html
5# for other configuration options
6#
7# normal logging, error messages and sent commands
8#log4perl.logger=ALL, ThrukLog
9
10# enable this line to enable debug logging
11# start "./script/thruk_server.pl -d" with -d to enable debugging
12log4perl.logger=ALL, ThrukLog{%- if config['debug-log'] -%}, DebugLog{%- endif -%}{%- if config['screen-log'] -%}, Screen{%- endif %}
13# you have to uncomment the logger definitions below too
14
15# normal log messages
16log4perl.appender.ThrukLog=Log::Dispatch::File
17log4perl.appender.ThrukLog.filename={{config['log-path']}}
18log4perl.appender.ThrukLog.mode=append
19log4perl.appender.ThrukLog.Threshold=INFO
20log4perl.appender.ThrukLog.layout=Log::Log4perl::Layout::PatternLayout
21log4perl.appender.ThrukLog.layout.ConversionPattern=[%d][%H][%p][%c] %m%n
22
23{%- if config['debug-log'] %}
24## debug too
25log4perl.appender.DebugLog=Log::Dispatch::File
26log4perl.appender.DebugLog.filename={{config['debug-log-path']}}
27log4perl.appender.DebugLog.mode=append
28log4perl.appender.DebugLog.Threshold=DEBUG
29log4perl.appender.DebugLog.layout=Log::Log4perl::Layout::PatternLayout
30log4perl.appender.DebugLog.layout.ConversionPattern=[%d][%H][%p][%c] %m%n
31{%- endif %}
32
33{%- if config['screen-log'] %}
34## screen logger
35#log4perl.logger = DEBUG, Screen
36log4perl.appender.Screen = Log::Log4perl::Appender::Screen
37log4perl.appender.Screen.stderr = 1
38log4perl.appender.Screen.Threshold = DEBUG
39log4perl.appender.Screen.layout = Log::Log4perl::Layout::PatternLayout
40log4perl.appender.Screen.layout.ConversionPattern = [%d][%H][%p][%c] %m%n
41{%- endif %}
42

Subscribers

People subscribed via source and target branches