Skip to content

Commit

Permalink
Management commands now log to console by default
Browse files Browse the repository at this point in the history
This is quite ugly approach, but I was not able to find better one, see
also:

http://stackoverflow.com/questions/12215436/separate-logging-for-management-commands

Fixes #213.
  • Loading branch information
nijel committed May 3, 2013
1 parent 01dacf6 commit ca25e0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "weblate.settings")
os.environ['DJANGO_IS_MANAGEMENT_COMMAND'] = '1'

from django.core.management import execute_from_command_line

Expand Down
4 changes: 4 additions & 0 deletions weblate/settings_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@
}
}

# Logging of management commands to console
if os.environ.get('DJANGO_IS_MANAGEMENT_COMMAND', False):
LOGGING['loggers']['weblate']['handlers'].append('console')

# Machine translation API keys

# Apertium Web Service, register at http://api.apertium.org/register.jsp
Expand Down

0 comments on commit ca25e0d

Please sign in to comment.