Routing of the logging messages

CodeSite logging interface classes: default "CodeSite" logger, T|CodeSiteLogger class, destinations, formatters, etc.

Routing of the logging messages

Postby janr » Fri Oct 28, 2011 4:44 am

I use Delphi XE, Windows 7, CodeSite 4.6.2.

I have an application, running on machine A and I want the logging on another machine B.
I set the TCP setting of the DefaultDestination property of the CodeSiteManager to machine B and this works.

I have the following questions:
1) I now have the settings of machine B hardcoded in my application on machine A. Suppose I want to route the logging coming from A to another machine, say C instead of B, while the application keeps on running and I don't want the user to do an extra action. Is this possible?
2) When logging-messages arrive at the dispatcher, it is already dermined by the sending application if the logging goes to the Live viewer or the Log-file. Is it possible to change the destination of the logging, fi by the controller?(Change fi from viewer to file or from viewer to a dispatcher on another machine)
3) In the 'Codesite Architecture' I see, that a local dispatcher can also route the logging-messages to a dispatcher on another machine. How is this realized?

I hope any one can help me.
Regards, Jan Reynaerts
Posts: 8
Thu Oct 27, 2011 5:00 pm

Re: Routing of the logging messages

Postby Raize Support » Fri Oct 28, 2011 9:51 pm

Hi Jan,

I'm going to answer your questions a bit out of order, because it will help explain things. Let me start with #3. The normal flow of CS messages transported to a remote machine looks like the following:

YourApp --> Local Dispatcher --> Remote Dispatcher --> Log File or Live Viewer

That is, when your apps sends a CodeSite message, the message data is captured by a CodeSite Logger and then transported to the CodeSite Dispatcher running on the same machine as your app. This local dispatcher then sends the CS message to a CodeSite Dispatcher running on the remote machine. When the remote Dispatcher receives a CS message it will dispatch it to a log file or the live viewer.

So, how does the Local Dispatcher know where to send the message? This is the role of the CodeSiteDestination. When you set the TCP properties of a CodeSiteDestination, you are instructing the "Local Dispatcher" what to do with messages it receives from a particular logger. In your opening comments, you mention that you set the CodeSiteManager.DefaultDestination.TCP settings. The DefaultDestination is used by all loggers used in your application (that do not override it themselves). The key is that the CodeSiteDestination determines what the **Local Dispatcher** does with the CodeSite messages it receives from your application/logger. In other words, the CodeSiteDestination does NOT control the message transport between your application and the Local Dispatcher. The ConnectUsing*** methods control the communication between the CodeSite loggers in your app and the Local Dispatcher.

So, continuing on to your first question. There is nothing that prevents you from making the TCP settings dynamic in your application. For example, you could store the settings in the Registry, or a config file, or even provide options in the app itself. This would allow you to configure the remote end points.

Another option would be to use the CodeSiteDestination.Alias property. This allows you to essentially define a "named" destination which is defined in the Dispatcher's INI file. You can change the Dispatcher's INI file to change how the alias gets resolved. There are more details in the help. As you can gather, someone will need to make some change to the configuration. Whether that is the user or an admin, someone needs to change the configuration.

Q2 is essentially the same as the first. The CodeSiteDestination details define where the messages go. These can be changed at the app level through configuration settings, or the Alias option can be used and they can be changed in the Dispatcher's INI file.

Raize Software Support
Raize Software
Raize Support
Posts: 622
Fri Mar 25, 2011 9:04 pm

Return to Loggers

Who is online

Users browsing this forum: No registered users and 1 guest