473,394 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Questions about app.config's <listeners> attributes

I'm modifying an existing piece of code that involves a custom trace
listener assembly but I simply don't understand the flow of control. How do
the bits and pieces fit together that implement and control a trace
listener? The existing Microsoft document that I've seen don't present
things in a manner that is meaningful to me so it would really be
appreciated if one of you more knowledgeable types who knows about this
would do the great favor of explaining in words of one syllable or less how
the individual parts of a custom trace listener interact with each other and
how the system knows how to hook them together.

Here's a related problem - what do the individual parts of the 'type'
attribute do? I've looked and looked but simply can't find a definition of
what information is supposed to go in the tag. Where does the 'name' value
get consumed? What does the first part of 'type' specify? Is it the name of
the object that implements the trace listener? And what's the second
argument, the 'Core.LogConsole' string do? Is it the assembly name as known
to the GAC that contains the trace listener object? And what about the
initializeData attribute?

<listeners>
<add name="LogConsoleListener" type="Core.Logging, Core.LogConsole,
Version=1.1.1.1, Culture=neutral;, PlublicKeyToken=1234abcd1234abcd"
initializeData="C:\Abc\Abc\Abc\" />
<listeners/>
--
Richard Lewis Haggard
www.Haggard-And-Associates.com
Apr 11 '06 #1
3 2342
I might be wrong on some parts here, but this is how I understand it
....

Type: This is broken into assembly, class, version, culture, public key
(obviously). In the example you had, this listener would exist in the
assembly Core.Logging. The listener's class name/type would be
Core.LogConsole. The assembly version number would be 1.1.1.1. The
culture and public key tokens, I'm not so sure about. I can only assume
they'd be used for globalization settings (which language, etc) and
identification, respectively.

Name: This is the listener's identification in the Listeners
collection. So, you can do
Trace.Listeners["LogConsoleListener"].DoSomething(); if you really
wanted to.

InitializeData: The data that you pass into the constructor of the
listener. In the case of TextWriterTraceListener, the example below
would create a file called "c:\abc\abc\abc\abc\" (Actually, this'd
error ... you'd need to tack on file.log or something, but you get the
point).

Hope this help - I'm sure someone'll be around sooner or later to
correct any mistakes I made.

Clint

Apr 11 '06 #2
Thanks.
After much failing about, I did manage to get the darned thing running
again.

I came up with a slightly different interpretation for the type string's two
parts.

Part-1) is the class that handles the trace logging functionality and is
mandatory.
Part-2) appears to be the name of the assembly that contains the class
specified in Part-1. It may or may not be present, depending upon the
implementation of the trace listener.
--
Richard Lewis Haggard
www.Haggard-And-Associates.com

"Clint (cm******@online.nospam)" <cj*******@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
I might be wrong on some parts here, but this is how I understand it
...

Type: This is broken into assembly, class, version, culture, public key
(obviously). In the example you had, this listener would exist in the
assembly Core.Logging. The listener's class name/type would be
Core.LogConsole. The assembly version number would be 1.1.1.1. The
culture and public key tokens, I'm not so sure about. I can only assume
they'd be used for globalization settings (which language, etc) and
identification, respectively.

Name: This is the listener's identification in the Listeners
collection. So, you can do
Trace.Listeners["LogConsoleListener"].DoSomething(); if you really
wanted to.

InitializeData: The data that you pass into the constructor of the
listener. In the case of TextWriterTraceListener, the example below
would create a file called "c:\abc\abc\abc\abc\" (Actually, this'd
error ... you'd need to tack on file.log or something, but you get the
point).

Hope this help - I'm sure someone'll be around sooner or later to
correct any mistakes I made.

Clint

Apr 11 '06 #3
You're absolutely right on the Type string. I was just working with
these yesterday and had come across a problem with my listeners (in my
case, I needed the assembly string) and was thinking backwards. Sorry
for any confusion.

Clint

Apr 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul Klanderud | last post by:
I'm encountering a strange situation with a .config file for a simple windows form test harness I built to test some components normally invoked by a windows service. My config file,...
4
by: Toby A Inkster | last post by:
In "the other place" Jukka has pointed out that semantically <blockquote/> is useless in many browsers, so I'm experimenting with Javascript to put some functionality back into <blockquote/>. ...
4
by: Steven T. Hatton | last post by:
I'm trying to create an baseclass that will serve as a parent for reference counted objects handled by boost::intrusive_ptr<>. The documentation didn't provide much in the way of describing what...
9
by: bmgz | last post by:
I need to execute a JavaScript function "onload". The only problem is I don not have access to the <body> tag as it is a part of the standard page-header include (a separate file). How could I have...
7
by: jerrygarciuh | last post by:
Hello, I have been playing with various Googled solutions for capturing the <Enter> key to suppress form submission. My first question is whether anyone has a script that works in all common...
0
by: Jim Heavey | last post by:
Hello, I am trying to figure out how to add <listeners> to the web config. The book that I am using shows the following: <system.diagnostics> <trace> <listeners> <add ....... />...
4
by: Jiho Han | last post by:
I have the following defined in web.config under <configuration> node: <system.diagnostics> <switches> <add name="MainSwitch" value="4"/> </switches>
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
0
by: msnews.microsoft.com | last post by:
Hi, I am tring to use Trace Listener in asp.net 1.1 application as mentoned here. But i am getting the following error, Configuration Error Description: An error occurred during the processing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.