Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-node
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
cc-node
Commits
1315ef40
Commit
1315ef40
authored
12 years ago
by
Anael Beutot
Browse files
Options
Downloads
Patches
Plain Diff
Change logging output in case debug is activated
otherwise log to syslog
parent
57e4c0a3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cloudcontrol/node/config.py
+22
-15
22 additions, 15 deletions
cloudcontrol/node/config.py
cloudcontrol/node/node.py
+1
-1
1 addition, 1 deletion
cloudcontrol/node/node.py
with
23 additions
and
16 deletions
cloudcontrol/node/config.py
+
22
−
15
View file @
1315ef40
...
...
@@ -43,6 +43,9 @@ class NodeConfigParser(object):
logger
.
error
(
'
Invalid value for debug in config file
'
)
self
.
debug
=
False
self
.
logging_level
=
int
(
config
.
get
(
'
verbosity
'
,
0
))
self
.
logging_output
=
'
console
'
if
self
.
debug
==
True
else
'
syslog
'
# path settings
self
.
jobs_store_path
=
config
.
get
(
'
jobs_store_path
'
,
'
/var/lib/cc-node/jobs
'
)
...
...
@@ -51,11 +54,25 @@ class NodeConfigParser(object):
'
/var/lib/cc-node/plugins
'
)
def
configure_logging
(
level
):
def
configure_logging
(
level
,
output
):
level
=
{
0
:
'
ERROR
'
,
1
:
'
WARNING
'
,
2
:
'
INFO
'
,
3
:
'
DEBUG
'
,
}[
level
]
output
=
dict
(
console
=
"""
[handler_output]
class=StreamHandler
formatter=simpleFormatter
args=(sys.stderr,)
"""
,
syslog
=
"""
[handler_output]
class=handlers.SysLogHandler
formatter=simpleFormatter
args=(
'
/dev/log
'
, handlers.SysLogHandler.LOG_DAEMON)
"""
,
)[
output
]
# create config parser for logging configuration
logging
.
config
.
fileConfig
(
StringIO
(
"""
...
...
@@ -63,16 +80,14 @@ def configure_logging(level):
keys=root,ccnode,cccommon,sjrpc
[handlers]
# keys=syslog
keys=consoleHandler
keys=output
[formatters]
keys=simpleFormatter
[logger_root]
level=ERROR
# handlers=syslog
handlers=consoleHandler
handlers=output
[logger_ccnode]
level=%(level)s
...
...
@@ -89,16 +104,8 @@ level=ERROR
handlers=
qualname=sjrpc
# [handler_syslog]
# class=handlers.SysLogHandler
# formatter=simpleFormatter
# args=(
'
/dev/log
'
, handlers.SysLogHandler.LOG_DAEMON)
[handler_consoleHandler]
class=StreamHandler
formatter=simpleFormatter
args=(sys.stderr,)
%(output)s
[formatter_simpleFormatter]
format=cc-node - %%(asctime)s - %%(name)s - %%(levelname)s - %%(message)s
"""
%
dict
(
level
=
level
)))
"""
%
dict
(
level
=
level
,
output
=
output
)))
This diff is collapsed.
Click to expand it.
cloudcontrol/node/node.py
+
1
−
1
View file @
1315ef40
...
...
@@ -74,7 +74,7 @@ class NodeLoop(MainLoop):
self
.
job_manager
=
JobManager
(
self
)
def
configure_logging
(
self
):
configure_logging
(
self
.
config
.
logging_level
)
configure_logging
(
self
.
config
.
logging_level
,
self
.
config
.
logging_output
)
def
stop
(
self
,
watcher
=
None
,
revents
=
None
):
MainLoop
.
stop
(
self
,
watcher
,
revents
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment