diff -r c50edf53c11e docs/ref/settings.txt
|
a
|
b
|
|
| 1006 | 1006 | A tuple of directories where Django looks for translation files. |
| 1007 | 1007 | See :ref:`using-translations-in-your-own-projects`. |
| 1008 | 1008 | |
| 1009 | | .. setting:: LOGIN_REDIRECT_URL |
| | 1009 | .. setting:: LOGGING |
| 1010 | 1010 | |
| 1011 | 1011 | LOGGING |
| 1012 | 1012 | ------- |
| … |
… |
|
| 1022 | 1022 | |
| 1023 | 1023 | .. versionadded:: 1.3 |
| 1024 | 1024 | |
| | 1025 | .. setting:: LOGGING_CONFIG |
| | 1026 | |
| 1025 | 1027 | LOGGING_CONFIG |
| 1026 | 1028 | -------------- |
| 1027 | 1029 | |
| … |
… |
|
| 1038 | 1040 | |
| 1039 | 1041 | .. versionadded:: 1.3 |
| 1040 | 1042 | |
| | 1043 | .. setting:: LOGIN_REDIRECT_URL |
| | 1044 | |
| 1041 | 1045 | LOGIN_REDIRECT_URL |
| 1042 | 1046 | ------------------ |
| 1043 | 1047 | |
diff -r c50edf53c11e docs/topics/logging.txt
|
a
|
b
|
|
| 35 | 35 | A logger is the entry point into the logging system. Each logger is |
| 36 | 36 | a named bucket to which messages can be written for processing. |
| 37 | 37 | |
| 38 | | A logger is configured to have *log level*. This log level describes |
| | 38 | A logger is configured to have a *log level*. This log level describes |
| 39 | 39 | the severity of the messages that the logger will handle. Python |
| 40 | 40 | defines the following log levels: |
| 41 | 41 | |
| … |
… |
|
| 59 | 59 | stack trace or an error code. |
| 60 | 60 | |
| 61 | 61 | When a message is given to the logger, the log level of the message is |
| 62 | | compare to the log level of the logger. If the log level of the |
| | 62 | compared to the log level of the logger. If the log level of the |
| 63 | 63 | message meets or exceeds the log level of the logger itself, the |
| 64 | 64 | message will undergo further processing. If it doesn't, the message |
| 65 | 65 | will be ignored. |
| … |
… |
|
| 76 | 76 | in a logger. It describes a particular logging behavior, such as |
| 77 | 77 | writing a message to the screen, to a file, or to a network socket. |
| 78 | 78 | |
| 79 | | Like loggers, handlers also have a log level. If the log level of a |
| | 79 | Like loggers, handlers also have a *log level*. If the log level of a |
| 80 | 80 | log record doesn't meet or exceed the level of the handler, the |
| 81 | 81 | handler will ignore the message. |
| 82 | 82 | |
| … |
… |
|
| 84 | 84 | different log level. In this way, it is possible to provide different |
| 85 | 85 | forms of notification depending on the importance of a message. For |
| 86 | 86 | example, you could install one handler that forwards ``ERROR`` and |
| 87 | | ``CRITICIAL`` messages to a paging service, while a second handler |
| | 87 | ``CRITICAL`` messages to a paging service, while a second handler |
| 88 | 88 | logs all messages (including ``ERROR`` and ``CRITICAL`` messages) to a |
| 89 | 89 | file for later analysis. |
| 90 | 90 | |
| … |
… |
|
| 143 | 143 | error log record will be written. |
| 144 | 144 | |
| 145 | 145 | Naming loggers |
| 146 | | ~~~~~~~~~~~~~~ |
| | 146 | -------------- |
| 147 | 147 | |
| 148 | 148 | The call to :meth:`logging.getLogger()` obtains (creating, if |
| 149 | 149 | necessary) an instance of a logger. The logger instance is identified |
| … |
… |
|
| 177 | 177 | can turn off this behavior. |
| 178 | 178 | |
| 179 | 179 | Making logging calls |
| 180 | | ~~~~~~~~~~~~~~~~~~~~ |
| | 180 | -------------------- |
| 181 | 181 | |
| 182 | 182 | The logger instance contains an entry method for each of the default |
| 183 | 183 | log levels: |
| … |
… |
|
| 190 | 190 | |
| 191 | 191 | There are two other logging calls available: |
| 192 | 192 | |
| 193 | | * ``logger.log()``: manually a logging message with a specific |
| | 193 | * ``logger.log()``: Manually emits a logging message with a specific |
| 194 | 194 | log level. |
| 195 | 195 | |
| 196 | | * ``logger.exception()``: create a ``ERRORR`` level logging |
| | 196 | * ``logger.exception()``: Create a ``ERROR`` level logging |
| 197 | 197 | message wrapping the current exception stack frame. |
| 198 | 198 | |
| 199 | 199 | Configuring logging |
| … |
… |
|
| 204 | 204 | formatters to ensure that logging output is output in a useful way. |
| 205 | 205 | |
| 206 | 206 | Python's logging library provides several techniques to configure |
| 207 | | logging, ranging from a programatic interface to configuration files. |
| | 207 | logging, ranging from a programmatic interface to configuration files. |
| 208 | 208 | By default, Django uses the `dictConfig format`_. |
| 209 | 209 | |
| 210 | 210 | .. note:: |
| … |
… |
|
| 320 | 320 | |
| 321 | 321 | * Defines three handlers: |
| 322 | 322 | |
| 323 | | * ``null``, a NullHandler, which will pass any `DEBUG` or |
| | 323 | * ``null``, a NullHandler, which will pass any ``DEBUG`` or |
| 324 | 324 | higher message to ``/dev/null``. |
| 325 | 325 | |
| 326 | | * ``console``, a StreamHandler, which will print any `DEBUG` |
| | 326 | * ``console``, a StreamHandler, which will print any ``DEBUG`` |
| 327 | 327 | message to stdout. This handler uses the `simple` output |
| 328 | 328 | format. |
| 329 | 329 | |
| 330 | 330 | * ``mail_admins``, an AdminEmailHandler, which will email any |
| 331 | | `ERROR` level message to the site admins. This handler uses |
| | 331 | ``ERROR`` level message to the site admins. This handler uses |
| 332 | 332 | the ``special`` filter. |
| 333 | 333 | |
| 334 | 334 | * Configures three loggers: |
| … |
… |
|
| 346 | 346 | or higher that also pass the ``special`` filter to two |
| 347 | 347 | handlers -- the ``console``, and ``mail_admins``. This |
| 348 | 348 | means that all ``INFO`` level messages (or higher) will be |
| 349 | | printed to the console; ``ERROR`` and ``CRITICIAL`` |
| | 349 | printed to the console; ``ERROR`` and ``CRITICAL`` |
| 350 | 350 | messages will also be output via e-mail. |
| 351 | 351 | |
| 352 | 352 | .. _formatter documentation: http://docs.python.org/library/logging.html#formatter-objects |