Best way to filter messages

Home Forums CodeSite Best way to filter messages

Viewing 2 reply threads
  • Author
    Posts
    • #378
      MARCOS LIMA
      Participant

        Hi

        I am using CodeSite in a Delphi Berlin application.
        I am wondering how is the best way to filter (in Dispatcher) messages based on level (message, warning, error, exception and so on).
        I know that there is a Category string in the message and I know that you can configure the filter in the Dispatcher but I don’t know how to:

        1) Program this filter so users don’t need to access system console to add filter-out categories. I don’t have control of User’s production environment so after installing our product, it starts sending messages and I have no way to force users to access console, edit Dispatcher settings in order to filter out ‘Debug’ category for instance.

        2) Category is a string only and moreover it’s a property of CodeSiteLogger class. I have a service that 100-200 users connect at the same time (and it’s just one CodeSite object). I think I would run into trouble if I change Category as there is 30-40 threads using the same object!

        So, How is the best way to deal with lots of messages filtering?

        PS: I cannot access Dispatcher Settings (it’s disabled), maybe it’s because it is a trial version (I’ve just bought a license)?

      • #391
        MARCOS LIMA
        Participant

          Is there anybody out there?

        • #396
          Ray Konopka
          Keymaster

            Hi Marcos,

            I apologize for the delay in responding. The short answer to your question is that you cannot filter CodeSite messages at the Dispatcher based on message type. You can filter messages based on Category at the Dispatcher level, but that is typically used once in a while in situations where filtering is needed but it is not possible to filter the messages at the program level.

            Instead, most developers will filter the messages that get “sent” by CodeSite by creating multiple CodeSite loggers for use their applications. For example, one might create a csCritical logger (with its Category property set to Critical) that is always Enabled. That way, any CodeSite message sent by csCrtical will get dispatched to the destination. Other loggers might be named csDebug, csDevelop, csExternal, csCommunication, etc.

            With the various loggers in place, developers simply use the appropriate logger to capture information. Moreover, many CodeSite users will provide a mechanism to enable/disable the various loggers used in their apps. This could be done through INI file settings, Registry entries, XML config files, etc.

            Therefore, to control the amount of information generated by an app is handled by configuring the app and not by restricting the messages that are dispatched by the Dispatcher. Also, by using Categories, you can focus on the content of your CodeSite messages and not an arbitrary logging level for the message.

            And finally, in order to update the Dispatcher settings, you need to have Admin rights. You can either start the Dispatcher as an Admin, or you can run the CodeSite Controller as an Admin at you will then be able to change the Dispatcher settings.

            Ray

        Viewing 2 reply threads
        • You must be logged in to reply to this topic.