Hi!
I have created a custom trace Listener class, called "DBTraceListene r"
it works fine when i add it manually in code :
(eg. Trace.listeners .add(new DBTraceListener ("myDBListener" ,
TraceLevel.Verb ose, getDBConnection ) )
What I'm trying to achieve now is to add this listener via the
MyApplication.e xe.config file
Here is my configuration file:
<configuratio n>
<system.diagnos tics>
<trace autoflush="true " indentsize="4">
<listeners>
<remove name ="Default"/>
<add name="myDBListe ner" type="DBTraceLi stener"/>
</listeners>
</trace>
</system.diagnost ics>
</configuration>
Unfortunately, when im executing the application the DefaultTraceLis tener is
removed BUT my DBTraceListener is not added!!! and I dont get any exceptions!
So what is going on?
Thanks in advance!
G. 8 3749
"Geopsaros" <Ge*******@disc ussions.microso ft.com> wrote in message
news:64******** *************** ***********@mic rosoft.com... Hi!
I have created a custom trace Listener class, called "DBTraceListene r"
it works fine when i add it manually in code : (eg. Trace.listeners .add(new DBTraceListener ("myDBListener" , TraceLevel.Verb ose, getDBConnection ) )
What I'm trying to achieve now is to add this listener via the MyApplication.e xe.config file
Here is my configuration file:
<configuratio n> <system.diagnos tics> <trace autoflush="true " indentsize="4"> <listeners> <remove name ="Default"/> <add name="myDBListe ner" type="DBTraceLi stener"/> </listeners> </trace> </system.diagnost ics> </configuration>
Unfortunately, when im executing the application the DefaultTraceLis tener is removed BUT my DBTraceListener is not added!!! and I dont get any exceptions! So what is going on?
From the above, it looks like your listener requires three parameters in its
constructor. How would those parameters be passed to it by the config file?
I'm surprised you don't get an exception, though. Try this experiment:
Change the "type" to "DBTraceListene rX" and see if you get an exception.
John Saunders
John, i have tried it! No exceptions, no errors ...nothing
I have also tried type="" and No type attribute at all!
As far as the constructor is concerced, There are 2 constructors,
one without parameters and one with 3 parameters.
The DBTraceListener works without problems when added programmaticall y with
either of those....
"John Saunders" wrote: "Geopsaros" <Ge*******@disc ussions.microso ft.com> wrote in message news:64******** *************** ***********@mic rosoft.com... Hi!
I have created a custom trace Listener class, called "DBTraceListene r"
it works fine when i add it manually in code : (eg. Trace.listeners .add(new DBTraceListener ("myDBListener" , TraceLevel.Verb ose, getDBConnection ) )
What I'm trying to achieve now is to add this listener via the MyApplication.e xe.config file
Here is my configuration file:
<configuratio n> <system.diagnos tics> <trace autoflush="true " indentsize="4"> <listeners> <remove name ="Default"/> <add name="myDBListe ner" type="DBTraceLi stener"/> </listeners> </trace> </system.diagnost ics> </configuration>
Unfortunately, when im executing the application the DefaultTraceLis tener is removed BUT my DBTraceListener is not added!!! and I dont get any exceptions! So what is going on?
From the above, it looks like your listener requires three parameters in its constructor. How would those parameters be passed to it by the config file?
I'm surprised you don't get an exception, though. Try this experiment: Change the "type" to "DBTraceListene rX" and see if you get an exception.
John Saunders
Below is an extract of what I used:
In fact, you have to fully identify your listener in the type attribute.
type="<fully qualified class (assembly.class Name)>, <dll name that holds the
class>"
By the way, the default CTOR gets called when pluggin from the config file.
Hope this help,
José
Snippet:
--------
<system.diagnos tics>
<switches>
<!-- Global switch used by ttc programs. This is the master switch.
Any severity values
above this level will be blocked and not passed to the registered
ttc listeners.
Valid values are: 0:none, 1:error, 2:warning, 3: info,
-->
<add name="ttcGlobal Switch" value="4" />
</switches>
<trace>
<listeners>
<remove name="Default" />
<add name="ttcTextLi stener"
type="Company.B ase.ttcTextTrac eListener,Compa ny.Base"/>
<add name="ttcEventL ogListener"
type="Company.B ase.ttcEventLog TraceListener,C ompany.Base"/>
<add name="ttcMailLi stener"
type="Company.B ase.ttcMailTrac eListener,Compa ny.Base"/>
</listeners>
</trace>
</system.diagnost ics>
"Geopsaros" <Ge*******@disc ussions.microso ft.com> a écrit dans le message de
news:64******** *************** ***********@mic rosoft.com... Hi!
I have created a custom trace Listener class, called "DBTraceListene r"
it works fine when i add it manually in code : (eg. Trace.listeners .add(new DBTraceListener ("myDBListener" , TraceLevel.Verb ose, getDBConnection ) )
What I'm trying to achieve now is to add this listener via the MyApplication.e xe.config file
Here is my configuration file:
<configuratio n> <system.diagnos tics> <trace autoflush="true " indentsize="4"> <listeners> <remove name ="Default"/> <add name="myDBListe ner" type="DBTraceLi stener"/> </listeners> </trace> </system.diagnost ics> </configuration>
Unfortunately, when im executing the application the DefaultTraceLis tener
is removed BUT my DBTraceListener is not added!!! and I dont get any
exceptions! So what is going on?
Thanks in advance! G.
I'll give some more details because i still cant make it work :(
My custom tracelistener is a class called "DBTraceListene r"
This class is inside a class called "DBFacade", which is declared
in a project called "DBAcces"
e.g Class DBFacade
......
Class DBTraceListener
......
End class 'DBTraceListene r
End class 'DBFacade
My Solution's starting project is called "ForeignOfficeV 2" and its a Windows
Application.
There arent any namespaces declared! Hence, the listener add line should be
: <add name="DBListene rFromConfigFile "
type="DBAcces.D BFacade.DBTrace Listener,DBAcce s"/>
Am I right? In case I am not, i'm also wondering why I dont get any
exceptions or error messages?
Any help is really appreciated!
"José Joye" wrote: Below is an extract of what I used:
In fact, you have to fully identify your listener in the type attribute.
type="<fully qualified class (assembly.class Name)>, <dll name that holds the class>"
By the way, the default CTOR gets called when pluggin from the config file.
Hope this help, José
Snippet: -------- <system.diagnos tics> <switches> <!-- Global switch used by ttc programs. This is the master switch. Any severity values above this level will be blocked and not passed to the registered ttc listeners. Valid values are: 0:none, 1:error, 2:warning, 3: info, --> <add name="ttcGlobal Switch" value="4" /> </switches> <trace> <listeners> <remove name="Default" /> <add name="ttcTextLi stener" type="Company.B ase.ttcTextTrac eListener,Compa ny.Base"/> <add name="ttcEventL ogListener" type="Company.B ase.ttcEventLog TraceListener,C ompany.Base"/> <add name="ttcMailLi stener" type="Company.B ase.ttcMailTrac eListener,Compa ny.Base"/> </listeners> </trace> </system.diagnost ics>
"Geopsaros" <Ge*******@disc ussions.microso ft.com> a écrit dans le message de news:64******** *************** ***********@mic rosoft.com... Hi!
I have created a custom trace Listener class, called "DBTraceListene r"
it works fine when i add it manually in code : (eg. Trace.listeners .add(new DBTraceListener ("myDBListener" , TraceLevel.Verb ose, getDBConnection ) )
What I'm trying to achieve now is to add this listener via the MyApplication.e xe.config file
Here is my configuration file:
<configuratio n> <system.diagnos tics> <trace autoflush="true " indentsize="4"> <listeners> <remove name ="Default"/> <add name="myDBListe ner" type="DBTraceLi stener"/> </listeners> </trace> </system.diagnost ics> </configuration>
Unfortunately, when im executing the application the DefaultTraceLis tener is removed BUT my DBTraceListener is not added!!! and I dont get any exceptions! So what is going on?
Thanks in advance! G.
"Geopsaros" <Ge*******@disc ussions.microso ft.com> wrote in message
news:5F******** *************** ***********@mic rosoft.com... I'll give some more details because i still cant make it work :(
My custom tracelistener is a class called "DBTraceListene r" This class is inside a class called "DBFacade", which is declared in a project called "DBAcces"
What happens when you "don't do that"? Pull the listener out to top level
and see what happens.
Afterwards, take a look at System.Type.Ass emblyQualifiedN ame.
John Saunders
I moved the "DBTraceListene r" class in a separate file in the "DBAcces"
project and YES it finally Worked!!!!
the add listener line is now as follows:
type="DBAcces.D BTraceListener, DBAcces"/>
thanks a lot John!
I hope someone can answer why a listener cant be added
when its class is declared inside another class, or how this can be done?
"John Saunders" wrote: "Geopsaros" <Ge*******@disc ussions.microso ft.com> wrote in message news:5F******** *************** ***********@mic rosoft.com... I'll give some more details because i still cant make it work :(
My custom tracelistener is a class called "DBTraceListene r" This class is inside a class called "DBFacade", which is declared in a project called "DBAcces"
What happens when you "don't do that"? Pull the listener out to top level and see what happens.
Afterwards, take a look at System.Type.Ass emblyQualifiedN ame.
John Saunders
If you have not defined any namespace within the DBAccess then you should
(at least I guess...) have the following: : <add name="DBListene rFromConfigFile " type="DBFacade. DBTraceListener ,DBAcces"/>
I assume that your DBTraceListener class derives from
System.Diagnost ics.TraceListen er and your DBAccess project generates a
DBAccess.dll file which is located in the same directory as your
xyz.exe.config file.
Hope this help,
-José
"Geopsaros" <Ge*******@disc ussions.microso ft.com> wrote in message
news:5F******** *************** ***********@mic rosoft.com... I'll give some more details because i still cant make it work :(
My custom tracelistener is a class called "DBTraceListene r" This class is inside a class called "DBFacade", which is declared in a project called "DBAcces"
e.g Class DBFacade ...... Class DBTraceListener ...... End class 'DBTraceListene r End class 'DBFacade
My Solution's starting project is called "ForeignOfficeV 2" and its a
Windows Application.
There arent any namespaces declared! Hence, the listener add line should
be : <add name="DBListene rFromConfigFile " type="DBAcces.D BFacade.DBTrace Listener,DBAcce s"/>
Am I right? In case I am not, i'm also wondering why I dont get any exceptions or error messages?
Any help is really appreciated!
"José Joye" wrote:
Below is an extract of what I used:
In fact, you have to fully identify your listener in the type attribute.
type="<fully qualified class (assembly.class Name)>, <dll name that holds
the class>"
By the way, the default CTOR gets called when pluggin from the config
file. Hope this help, José
Snippet: -------- <system.diagnos tics> <switches> <!-- Global switch used by ttc programs. This is the master
switch. Any severity values above this level will be blocked and not passed to the
registered ttc listeners. Valid values are: 0:none, 1:error, 2:warning, 3: info, --> <add name="ttcGlobal Switch" value="4" /> </switches> <trace> <listeners> <remove name="Default" /> <add name="ttcTextLi stener" type="Company.B ase.ttcTextTrac eListener,Compa ny.Base"/> <add name="ttcEventL ogListener" type="Company.B ase.ttcEventLog TraceListener,C ompany.Base"/> <add name="ttcMailLi stener" type="Company.B ase.ttcMailTrac eListener,Compa ny.Base"/> </listeners> </trace> </system.diagnost ics>
"Geopsaros" <Ge*******@disc ussions.microso ft.com> a écrit dans le
message de news:64******** *************** ***********@mic rosoft.com... Hi!
I have created a custom trace Listener class, called "DBTraceListene r"
it works fine when i add it manually in code : (eg. Trace.listeners .add(new DBTraceListener ("myDBListener" , TraceLevel.Verb ose, getDBConnection ) )
What I'm trying to achieve now is to add this listener via the MyApplication.e xe.config file
Here is my configuration file:
<configuratio n> <system.diagnos tics> <trace autoflush="true " indentsize="4"> <listeners> <remove name ="Default"/> <add name="myDBListe ner" type="DBTraceLi stener"/> </listeners> </trace> </system.diagnost ics> </configuration>
Unfortunately, when im executing the application the
DefaultTraceLis tener is removed BUT my DBTraceListener is not added!!! and I dont get any exceptions! So what is going on?
Thanks in advance! G.
"Geopsaros" <Ge*******@disc ussions.microso ft.com> wrote in message
news:6A******** *************** ***********@mic rosoft.com... I moved the "DBTraceListene r" class in a separate file in the "DBAcces" project and YES it finally Worked!!!!
the add listener line is now as follows: type="DBAcces.D BTraceListener, DBAcces"/>
thanks a lot John!
I hope someone can answer why a listener cant be added when its class is declared inside another class, or how this can be done?
Afterwards, take a look at System.Type.Ass emblyQualifiedN ame.
John
"John Saunders" wrote:
"Geopsaros" <Ge*******@disc ussions.microso ft.com> wrote in message news:5F******** *************** ***********@mic rosoft.com... > I'll give some more details because i still cant make it work :( > > My custom tracelistener is a class called "DBTraceListene r" > This class is inside a class called "DBFacade", which is declared > in a project called "DBAcces"
What happens when you "don't do that"? Pull the listener out to top level and see what happens.
Afterwards, take a look at System.Type.Ass emblyQualifiedN ame.
John Saunders This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kevin Pease |
last post by:
Hi,
I've written a custom trace listener and am currently trying to test it by
registering it in the app config of another app. Every time the app runs I
get a message saying
"Couldn't find type for class LiveTrace.clsMSMQPublisher, LiveTrace."
The app config file appears below:
<configuration>
|
by: Richard |
last post by:
Hi,
I'm having trouble setting up a config file based trace switch & listener. I added an application config file to my console based C# program using the "Add New Application Config File" button from solution explorer. My config file is composed of the following, which is almost a verbatum cut & paste from MSDN help:
---------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>...
|
by: Schorschi |
last post by:
Ok, can someone point out to me why the following code does not work?
In compiles, no errors, but MemoryStream never seems to receive any
data?
Dim theMemory As MemoryStream, _
theListener As TextWriterTraceListener
theMemory = New MemoryStream(4096)
theListener = New TextWriterTraceListener(theMemory)
|
by: Jason L James |
last post by:
Hi all,
can anyone help me with some tracing I am trying to do
in my application. I have a configuration file containing
the XML as detailed below:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
|
by: Geopsaros |
last post by:
Hi!
I have created a custom trace Listener class, called "DBTraceListener"
it works fine when i add it manually in code :
(eg. Trace.listeners.add(new DBTraceListener("myDBListener",
TraceLevel.Verbose, getDBConnection) )
What I'm trying to achieve now is to add this listener via the
MyApplication.exe.config file
| |
by: Eniac |
last post by:
Hello,
I've started using Enterprise Library 2.0 recently and I've encountered
a problem that seems to be ... well... undocumented :)
Basically, when I set a Trace Listener (formatted event log to be
precise), if i specify the name of a custom event log, the listener
won't log in it.
I've checked in the registry, the log is there. In the event viewer, I
|
by: Tris |
last post by:
I've got a web service running, and i'm trying to build tracing into it that
is outputted to a file. Unfortunately, i can't find a way of enabling TRACE
token, and it just seems to skip over all System.Diagnostics.Trace lines in
the debugger.
I don't want to use the ASP page trace dump, as it will break my SOAP
interface.
This code is called on my application start event:
|
by: herbert |
last post by:
I am using a TraceSource object configured via app.config. In order to delete
the old file before starting the new trace, I need to obtain the filename
from the listener. What am I doing wrong in the following sample:
Dim trc As New TraceSource("HappySource")
‘filename returns Nothing:
Dim filename As String = _
trc.Listeners.Item("myTextListener").Attributes("initializeData")
app.config part:
|
by: boldtbanan |
last post by:
I've created a custom trace listener which I'd like to initialize in
the web.config file of my application. I noticed that I can use the
initializeData attribute to pass a string to the constructor of my
custom trace listener, but is there any way to pass multiple
parameters to the constructor through the web.config initialization?
For example, I have a custom trace listener that sends email
notification of errors. I'd like to...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |