From 4d09db3f32ec2e6e4b6cc690a8c0d67a53ef066d Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Thu, 5 Sep 2019 23:10:09 +0300 Subject: [PATCH 1/2] feat(logging): Add section about logging to self-hosted Follow up to https://forum.sentry.io/t/sentry-internal-debug-log-verbosity/7056/2?u=byk --- .../_documentation/server/config.md | 51 +++++++++++++++++-- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/src/collections/_documentation/server/config.md b/src/collections/_documentation/server/config.md index 7805485256da2..9b2727c010700 100644 --- a/src/collections/_documentation/server/config.md +++ b/src/collections/_documentation/server/config.md @@ -27,7 +27,7 @@ Many settings available in `config.yml` will also be able to be configured in th The environment name for this installation. This will also control defaults for things like `DEBUG`. - ```python + ```bash SENTRY_ENVIRONMENT=production sentry ... ``` @@ -37,7 +37,7 @@ Many settings available in `config.yml` will also be able to be configured in th The technical contact address for this installation. This will be reported to upstream to the Sentry team (as part of the Beacon), and will be the point of contact for critical updates and security notifications. - ```python + ```yaml system.admin-email: 'admin@example.com' ``` @@ -47,7 +47,7 @@ Many settings available in `config.yml` will also be able to be configured in th The URL prefix in which Sentry is accessible. This will be used both for referencing URLs in the UI, as well as in outbound notifications. - ```python + ```yaml system.url-prefix: 'https://sentry.example.com' ``` @@ -57,7 +57,7 @@ Many settings available in `config.yml` will also be able to be configured in th A secret key used for session signing. If this becomes compromised it’s important to regenerate it as otherwise its much easier to hijack user sessions. - ```python + ```yaml system.secret-key: 'a-really-long-secret-value' ``` @@ -65,6 +65,47 @@ Many settings available in `config.yml` will also be able to be configured in th > $ sentry config generate-secret-key +## Logging + +Sentry logs to two major places: `stdout`, and it's internal project. To disable logging to the internal project, add a logger who's only handler is `'console'` and disable propagating upwards. + + {% include components/alert.html + content="The CLI flag and environment variable explained below override the root logger and anything in `LOGGING.overridable`. Be very careful with this in a production system, because the celery logger can be extremely verbose when set to INFO or DEBUG." + level="warning" + %} + +`-l/--loglevel` + +: Declared on the command line. + + Sentry has the ability to override logger levels by providing the CLI with the `-l/--loglevel` flag. + The value of this can be one of the [standard python logging level strings](https://docs.python.org/2/library/logging.html#levels). + + ```shell + sentry --loglevel=WARNING + ``` + +`SENTRY_LOG_LEVEL` + +: Declared in system environment. + + Sentry has the ability to override logger levels with the `SENTRY_LOG_LEVEL` environment variable. + The value of this can be one of the [standard python logging level strings](https://docs.python.org/2/library/logging.html#levels). + + ```shell + SENTRY_LOG_LEVEL=WARNING sentry ... + ``` + +`LOGGING` + +: Declared in `sentry.conf.py`. + + You can modify or override the full logging configuration with this setting. Be careful not to reomve or override important defaults. You can check [the default configuration](https://git.io/fjjna) for reference. + + ```python + LOGGING['default_level'] = 'WARNING' + ``` + ## Redis `redis.clusters` @@ -75,7 +116,7 @@ Many settings available in `config.yml` will also be able to be configured in th For example, - ```python + ```yaml redis.clusters: default: # cluster name hosts: # connection options, passed to `rb.Cluster` From 2e7befa4d128eea077fb94254f39b154595a5935 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Fri, 6 Sep 2019 17:14:27 +0300 Subject: [PATCH 2/2] make it better, stronger no work after --- src/collections/_documentation/server/config.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/collections/_documentation/server/config.md b/src/collections/_documentation/server/config.md index 9b2727c010700..b191d79a239f0 100644 --- a/src/collections/_documentation/server/config.md +++ b/src/collections/_documentation/server/config.md @@ -67,10 +67,10 @@ Many settings available in `config.yml` will also be able to be configured in th ## Logging -Sentry logs to two major places: `stdout`, and it's internal project. To disable logging to the internal project, add a logger who's only handler is `'console'` and disable propagating upwards. +Sentry logs to two major places — `stdout`, and its internal project. To disable logging to the internal project, add a logger whose only handler is `'console'` and disable propagating upwards. {% include components/alert.html - content="The CLI flag and environment variable explained below override the root logger and anything in `LOGGING.overridable`. Be very careful with this in a production system, because the celery logger can be extremely verbose when set to INFO or DEBUG." + content="Explained below are the CLI flag and environment variable. They override the root logger and anything in `LOGGING.overridable`. Be very careful with this in a production system, because the Celery logger can be extremely verbose when set to INFO or DEBUG." level="warning" %} @@ -78,8 +78,8 @@ Sentry logs to two major places: `stdout`, and it's internal project. To disable : Declared on the command line. - Sentry has the ability to override logger levels by providing the CLI with the `-l/--loglevel` flag. - The value of this can be one of the [standard python logging level strings](https://docs.python.org/2/library/logging.html#levels). + Sentry can override logger levels by providing the CLI with the `-l/--loglevel` flag. + The value of this can be one of the [standard Python logging level strings](https://docs.python.org/2/library/logging.html#levels). ```shell sentry --loglevel=WARNING @@ -89,8 +89,8 @@ Sentry logs to two major places: `stdout`, and it's internal project. To disable : Declared in system environment. - Sentry has the ability to override logger levels with the `SENTRY_LOG_LEVEL` environment variable. - The value of this can be one of the [standard python logging level strings](https://docs.python.org/2/library/logging.html#levels). + Sentry can override logger levels with the `SENTRY_LOG_LEVEL` environment variable. + The value of this can be one of the [standard Python logging level strings](https://docs.python.org/2/library/logging.html#levels). ```shell SENTRY_LOG_LEVEL=WARNING sentry ... @@ -100,7 +100,7 @@ Sentry logs to two major places: `stdout`, and it's internal project. To disable : Declared in `sentry.conf.py`. - You can modify or override the full logging configuration with this setting. Be careful not to reomve or override important defaults. You can check [the default configuration](https://git.io/fjjna) for reference. + You can modify or override the full logging configuration with this setting. Be careful not to remove or override important defaults. You can check [the default configuration](https://git.io/fjjna) for reference. ```python LOGGING['default_level'] = 'WARNING'