From d8849c6e3394708fa526a7d2e21f4f5de79736d1 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 27 Jan 2006 20:15:19 +0000 Subject: Added Logging page to quickstart tutorial. --- demos/quickstart/protected/controls/TopicList.tpl | 2 +- .../protected/pages/Advanced/Logging.page | 60 ++++++++++++++++++++++ .../protected/pages/Advanced/Performance.page | 2 +- 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 demos/quickstart/protected/pages/Advanced/Logging.page (limited to 'demos') diff --git a/demos/quickstart/protected/controls/TopicList.tpl b/demos/quickstart/protected/controls/TopicList.tpl index c2a36390..02aaacaf 100644 --- a/demos/quickstart/protected/controls/TopicList.tpl +++ b/demos/quickstart/protected/controls/TopicList.tpl @@ -47,7 +47,7 @@
  • TDataList
  • TDataGrid
  • Active Controls
  • -
  • Authoring New Controls
  • +
  • Creating New Controls
  • diff --git a/demos/quickstart/protected/pages/Advanced/Logging.page b/demos/quickstart/protected/pages/Advanced/Logging.page new file mode 100644 index 00000000..ac842c2e --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Logging.page @@ -0,0 +1,60 @@ + + +

    Logging

    +

    +PRADO provides a highly flexible and extensible logging functionality. Messages logged can be classified according to log levels and message categories. Using level and category filters, the messages can be further routed to different destinations, such as files, emails, browser windows, etc. The following diagram shows the basic architecture of PRADO logging mechanism, +

    + +

    Using Logging Functions

    +

    +The following two methods are provided for logging messages in PRADO, +

    + +Prado::log($message, $logLevel, $category); +Prado::trace($message, $category); + +

    +The difference between Prado::log() and Prado::trace() is that the latter automatically selects the log level according to the application mode. If the application is in Debug mode, stack trace information is appended to the messages. Prado::trace() is widely used in the core code of the PRADO framework. +

    + +

    Message Routing

    +

    +Messages logged using the above two functions are kept in memory. To make use of the messages, developers need to route them to specific destinations, such as files, emails, or browser windows. The message routing is managed by System.Log.TLogRouter module. When plugged into an application, it can route the messages to different destination in parallel. Currently, PRADO provides three types of routes: +

    + +

    +To enable message routing, plug in and configure the TLogRouter module in application configuration, +

    + +<module id="log" class="System.Log.TLogRouter"> + <route class="TBrowserLogRoute" + Levels="Info" + Categories="System.Web.UI.TPage, System.Web.UI.WebControls" /> + <route class="TFileLogRoute" + Levels="Warning, Error" + Categories="System.Web" /> +</module> + +

    +In the above, the Levels and Categories specify the log and category filters to selectively retrieve the messages to the corresponding destinations. +

    + +

    Message Filtering

    +

    +Messages can be filtered according to their log levels and categories. Each log message is associated with a log level and a category. With levels and categories, developers can selectively retrieve messages that they are interested on. +

    +

    +Log levels defined in System.Log.TLogger include : DEBUG, INFO, NOTICE, WARNING, ERROR, ALERT, FATAL. Messages can be filtered according log level criteria. For example, if a filter specifies WARNING and ERROR levels, then only those messages that are of WARNING and ERROR will be returned. +

    +

    +Message categories are hierarchical. A category whose name is the prefix of another is said to be the ancestor category of the other category. For example, System.Web category is the ancestor of System.Web.UI and System.Web.UI.WebControls categories. Messages can be selectively retrieved using such hierarchical category filters. For example, if the category filter is System.Web, then all messages in the System.Web are returned. In addition, messages in the childd categories, such as System.Web.UI.WebControls, are also returned. +

    +

    +By convention, the messages logged in the core code of PRADO are categorized according to the namespace of the corresponding classes. For example, messsages logged in TPage will be of category System.Web.UI.TPage. +

    + +
    \ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/Performance.page b/demos/quickstart/protected/pages/Advanced/Performance.page index 8b10da56..dda6ad82 100644 --- a/demos/quickstart/protected/pages/Advanced/Performance.page +++ b/demos/quickstart/protected/pages/Advanced/Performance.page @@ -35,7 +35,7 @@ where $keyName should be a string that uniquely identifies the data ite

    Using pradolite.php

    -Including many PHP script files may impact application performance significantly. PRADO classes are stored in different files and when processing a page request, it may require including tens of class files.To alleviate this problem, in each PRADO release, a file named pradolite.php is also included. The file is a merge of all core PRADO class files whose comments are also stripped off. +Including many PHP script files may impact application performance significantly. PRADO classes are stored in different files and when processing a page request, it may require including tens of class files.To alleviate this problem, in each PRADO release, a file named pradolite.php is also included. The file is a merge of all core PRADO class files with comments being stripped off and message logging removed.

    To use pradolite.php, in your application entry script, replace the inclusion of prado.php with pradolite.php. -- cgit v1.2.3