Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
737c7f5b
Commit
737c7f5b
authored
Dec 06, 2017
by
sim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Log django backend activity into a logfile
parent
093bbef5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
0 deletions
+54
-0
.gitignore
.gitignore
+1
-0
settings.py
gargantext/backend/settings.py
+45
-0
gargantext.template.ini
tools/conf/gargantext.template.ini
+4
-0
mkconf.sh
tools/mkconf.sh
+4
-0
No files found.
.gitignore
View file @
737c7f5b
...
...
@@ -4,3 +4,4 @@ __pycache__
.env
gargantext.ini
postgrest.conf
*.log
gargantext/backend/settings.py
View file @
737c7f5b
...
...
@@ -76,6 +76,45 @@ TEMPLATES = [
WSGI_APPLICATION
=
'gargantext.backend.wsgi.application'
# Logging
LOG_LEVEL
=
config
(
'LOG_LEVEL'
,
default
=
'DEBUG'
if
DEBUG
else
'INFO'
)
LOGGING
=
{
'version'
:
1
,
'disable_existing_loggers'
:
False
,
'formatters'
:
{
'verbose'
:
{
'format'
:
'
%(levelname)
s
%(asctime)
s
%(name)
s
%(process)
d
%(threadName)
s
%(message)
s'
},
'simple'
:
{
'format'
:
'
%(levelname)
s
%(message)
s'
},
},
'handlers'
:
{
'file'
:
{
'level'
:
LOG_LEVEL
,
'class'
:
'logging.FileHandler'
,
'filename'
:
config
(
'LOG_FILE'
,
default
=
'gargantext.log'
),
'formatter'
:
config
(
'LOG_FORMATTER'
,
default
=
'verbose'
),
},
},
'loggers'
:
{
'django'
:
{
'handlers'
:
[
'file'
],
'level'
:
LOG_LEVEL
,
'propagate'
:
True
,
},
'django.template'
:
{
# Don't keep debug logs for template module to avoid annoying and
# useless noise, see:
# https://github.com/encode/django-rest-framework/issues/3982#issuecomment-325290221
'level'
:
'INFO'
if
LOG_LEVEL
==
'DEBUG'
else
LOG_LEVEL
,
},
},
}
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
...
...
@@ -97,6 +136,7 @@ DATABASES['default']['URL'] = \
**
DATABASES
[
'default'
]
)
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
...
...
@@ -115,6 +155,7 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
...
...
@@ -128,6 +169,7 @@ USE_L10N = True
USE_TZ
=
True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
...
...
@@ -146,6 +188,7 @@ STATICFILES_FINDERS = (
MEDIA_ROOT
=
os
.
path
.
join
(
BASE_DIR
,
'media'
)
MEDIA_URL
=
'/media/'
# Asynchronous tasks
import
djcelery
...
...
@@ -162,6 +205,7 @@ CELERY_IMPORTS = (
"gargantext.util.ngramlists_tools"
,
)
# REST-API
# See http://getblimp.github.io/django-rest-framework-jwt/#additional-settings
...
...
@@ -202,6 +246,7 @@ API_TOKENS = {
}
}
# BOOL Interpreter
BOOL_TOOLS_PATH
=
"gargantext/util/crawlers/sparql"
tools/conf/gargantext.template.ini
View file @
737c7f5b
...
...
@@ -14,6 +14,10 @@ DB_PORT = {DB_PORT}
DB_NAME
=
{DB_NAME}
DB_USER
=
{DB_USER}
DB_PASS
=
{DB_PASS}
# Logs
LOG_FILE
=
/var/log/gargantext/backend/django.log
LOG_LEVEL
=
{LOG_LEVEL}
LOG_FORMATTER
=
verbose
[uwsgi]
...
...
tools/mkconf.sh
View file @
737c7f5b
...
...
@@ -88,6 +88,8 @@ if [ -z "$TIME_ZONE" ]; then
TIME_ZONE
=
${
TIME_ZONE
:-
UTC
}
fi
[
"
$DEBUG
"
=
"False"
]
&&
LOG_LEVEL
=
INFO
||
LOG_LEVEL
=
DEBUG
echo
"▸ PostgreSQL configuration..."
DB_NAME_DEFAULT
=
gargandb
...
...
@@ -144,6 +146,7 @@ DB_PORT=$(escape_ini "${DB_PORT:-5432}")
DB_NAME
=
$(
escape_ini
"
$DB_NAME
"
)
DB_USER
=
$(
escape_ini
"
$DB_USER
"
)
DB_PASS
=
$(
escape_ini
"
$DB_PASS
"
)
LOG_LEVEL
=
$(
escape_ini
"
$LOG_LEVEL
"
)
VENV
=
$(
escape_ini
"
$VENV
"
)
echo
"▸ Generate configuration file from
$GARGANTEXT_TEMPLATE
..."
...
...
@@ -155,6 +158,7 @@ sed -E -e "s/[{]DEBUG[}]/$DEBUG/g" \
-
e
"s/[{]DB_NAME[}]/
$DB_NAME
/g"
\
-
e
"s/[{]DB_USER[}]/
$DB_USER
/g"
\
-
e
"s/[{]DB_PASS[}]/
$DB_PASS
/g"
\
-
e
"s/[{]LOG_LEVEL[}]/
$LOG_LEVEL
/g"
\
-
e
"s/[{]VENV[}]/
$VENV
/g"
\
"
$GARGANTEXT_TEMPLATE
"
>
"
$GARGANTEXT_CONF
"
\
&&
echo
"Configuration for
$TARGET
environment written successfully in"
\
...
...
Write
Preview
Markdown
is supported
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