Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
c1878eb9
Commit
c1878eb9
authored
Mar 29, 2019
by
Markus Scheidgen
Browse files
Fix config of loglevels issues.
parent
68d9eccc
Pipeline
#46152
passed with stages
in 16 minutes and 11 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/config.py
View file @
c1878eb9
...
...
@@ -171,8 +171,8 @@ auxfile_cutoff = 30
console_log_level
=
logging
.
WARNING
def
get_loglevel_from_env
(
key
,
default_level
=
logging
.
INFO
):
plain_value
=
os
.
environ
.
get
(
key
,
None
)
def
normalize_loglevel
(
value
,
default_level
=
logging
.
INFO
):
plain_value
=
value
if
plain_value
is
None
:
return
default_level
else
:
...
...
@@ -183,8 +183,8 @@ def get_loglevel_from_env(key, default_level=logging.INFO):
transformations
=
{
'console_log_level'
:
get_loglevel_from_env
,
'logstash_level'
:
get_loglevel_from_env
'console_log_level'
:
normalize_loglevel
,
'logstash_level'
:
normalize_loglevel
}
...
...
nomad/utils.py
View file @
c1878eb9
...
...
@@ -48,6 +48,8 @@ import re
from
werkzeug.exceptions
import
HTTPException
import
hashlib
from
nomad
import
config
default_hash_len
=
28
""" Length of hashes and hash-based ids (e.g. calc, upload) in nomad. """
...
...
@@ -164,7 +166,6 @@ class LogstashFormatter(logstash.formatter.LogstashFormatterBase):
message
[
key
]
=
value
else
:
from
nomad
import
config
structlog
[
'nomad.service'
]
=
config
.
service
structlog
[
'nomad.release'
]
=
config
.
release
message
.
update
(
structlog
)
...
...
@@ -212,7 +213,6 @@ def add_logstash_handler(logger):
if
isinstance
(
handler
,
LogstashHandler
)),
None
)
if
logstash_handler
is
None
:
from
nomad
import
config
logstash_handler
=
LogstashHandler
(
config
.
logstash
.
host
,
config
.
logstash
.
tcp_port
,
version
=
1
)
...
...
@@ -222,8 +222,6 @@ def add_logstash_handler(logger):
def
configure_logging
():
from
nomad
import
config
# configure structlog
log_processors
=
[
StackInfoRenderer
(),
...
...
@@ -277,8 +275,6 @@ def get_logger(name, **kwargs):
Returns a structlog logger that is already attached with a logstash handler.
Use additional *kwargs* to pre-bind some values to all events.
"""
from
nomad
import
config
if
name
.
startswith
(
'nomad.'
):
name
=
'.'
.
join
(
name
.
split
(
'.'
)[:
2
])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment