473,545 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

simple logging in a C# COM DLL

I have created a very simple C# class library (DLL).

I have ticked the "Register for COM interop" option in the project
properties dialog.

I have made the [assembly: ComVisible(true )] in the AssemblyInfo.cs file.

I can call a public method in this library from VBScript.

So far so good, now I'd like to have some very *simple* loggging capability.

For other applications I've gone down the [log4net] route and rolled by own
loggers etc...etc.

For this tiny DLL, I'd like to have for example the option to just drop a
[myDll.dll.confi g] file into the same directory as the DLL and add a trace
listener that outputs to a file or optionally roll my own trace listener
(i.e. udp).

I've successfully done things with trace listeners, but cannot get the DLL
to pick up the custom trace listener config file.

I've tried various names for the config file, but no joy.

Any suggestions?

Is it because I'm calling it from a VBScript file and not a .NET application?
Jun 27 '08 #1
2 2142
On May 9, 12:51*pm, wurzelCidermake r
<wurzelCiderma. ..@discussions. microsoft.comwr ote:
I have created a very simple C# class library (DLL).

I have ticked the "Register for COM interop" option in the project
properties dialog.

I have made the [assembly: ComVisible(true )] in the AssemblyInfo.cs file.

I can call a public method in this library from VBScript.

So far so good, now I'd like to have some very *simple* loggging capability.

For other applications I've gone down the [log4net] route and rolled by own
loggers etc...etc.

For this tiny DLL, I'd like to have for example the option to just drop a
[myDll.dll.confi g] file into the same directory as the DLL and add a trace
listener that outputs to a file or optionally roll my own trace listener
(i.e. udp).

I've successfully done things with trace listeners, but cannot get the DLL
to pick up the custom trace listener config file.

I've tried various names for the config file, but no joy.

Any suggestions?

Is it because I'm calling it from a VBScript file and not a .NET application?
Hi,

By default a DLL has no config file. What you can do is read the
config in your code , make the file to reside in the same folder of
the dll, then you can read it using something like
System.IO.Path. GetDirectoryNam e( Assembly.GetRun ningAssembly(). Location)
+ "\\log.conf ig";
Jun 27 '08 #2

So are you saying that a DLL cannot read a [myDll.dll.confi g] automatcially
and add a trace listener contained in that config file?

"Ignacio Machin ( .NET/ C# MVP )" wrote:
On May 9, 12:51 pm, wurzelCidermake r
<wurzelCiderma. ..@discussions. microsoft.comwr ote:
I have created a very simple C# class library (DLL).

I have ticked the "Register for COM interop" option in the project
properties dialog.

I have made the [assembly: ComVisible(true )] in the AssemblyInfo.cs file.

I can call a public method in this library from VBScript.

So far so good, now I'd like to have some very *simple* loggging capability.

For other applications I've gone down the [log4net] route and rolled by own
loggers etc...etc.

For this tiny DLL, I'd like to have for example the option to just drop a
[myDll.dll.confi g] file into the same directory as the DLL and add a trace
listener that outputs to a file or optionally roll my own trace listener
(i.e. udp).

I've successfully done things with trace listeners, but cannot get the DLL
to pick up the custom trace listener config file.

I've tried various names for the config file, but no joy.

Any suggestions?

Is it because I'm calling it from a VBScript file and not a .NET application?

Hi,

By default a DLL has no config file. What you can do is read the
config in your code , make the file to reside in the same folder of
the dll, then you can read it using something like
System.IO.Path. GetDirectoryNam e( Assembly.GetRun ningAssembly(). Location)
+ "\\log.conf ig";
Jun 27 '08 #3

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

Similar topics

2
2343
by: John Ramsden | last post by:
I have a perl logging module that sends log messages, via post variables, to a simple PHP web app whose purpose is to write them to a database table. The module is organized in the standard Test::Simple format, and as one of the unit tests I'd like to include a message send (followed by a read of the database table). But to make the tests...
4
4147
by: Paul Moore | last post by:
I hit a problem yesterday with my mail connection. In a desparate attempt to understand what was going on, I wanted to log the connection traffic. After a bit of searching, I found a post on c.l.p from Andrew Bennetts explaining how to run a port forwarder in 2 lines using Twisted. $ mktap portforward -p 8000 -h remote -d 20 $ twistd -f...
1
2022
by: Ajay | last post by:
hi! i have created a logger self.logger = logging.getLogger('smsapp') hdlr = logging.FileHandler('logs/smsapp.log') formatter = logging.Formatter ('%(asctime)s %(levelname)s %(message)s') hdlr.setFormatter(formatter) self.logger.addHandler(hdlr) self.logger.setLevel(logging.DEBUG)
1
3657
by: jjesso | last post by:
I am trying to add a new logging level. logging.config.fileConfig("bengineLog.cfg") logging.CLIENT = logging.INFO + 1 logging.addLevelName( logging.CLIENT, 'CLIENT' ) logging.root.setLevel( ) logger = logging.getLogger(None) logging.Logger.client('test') I get error:
0
395
by: Karuppasamy | last post by:
H I am trying to use the Logging Module provided by Microsoft Application Blocks for .Net I installed everything as per the Instructions given in the 'Development Using the Logging Block' But when i am trying to run the sample, i am getting the following error in the Event Viwer Kindly help me on this
4
1945
by: David | last post by:
Hello, I want to write a simple logging class. But when I instantiate the logger with Logger::logger log("log.log"); I get a "Bus Error - core dumped". Can anybody help? Thanks beforehand, David This is my logger.hpp file (I tried it with .h, too.)
6
10231
by: Burkhard Schultheis | last post by:
As I wrote last week, we have a problem with a DB2 V8 on Linux. Here is what is in db2diag.log during online backup: Starting a full database backup. 2004-04-01-02.33.54.760164 Instance:lzgneu Node:000 PID:1293(db2loggw (TELEMATX)) TID:1024 Appid:none data protection sqlpgwlp Probe:909 TailPage 0 does not match pagelsn...
0
2090
by: rajesh.hanchate | last post by:
Please help me in resolving this issue. I am using EnterpriseLibrary 2.0 Exception and logging block for logging exceptions to event log. It works fine for sometime. After some time it stops logging to event log. To make it active again I need to open the web.config and save without making any changes. It starts to work again. Here is the...
176
8194
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write their own unit test framework, and then in a lab session see if I can get them to write their own. To give them an example I've created the...
3
11516
by: Chris Shenton | last post by:
I am setting up handlers to log DEBUG and above to a rotating file and ERROR and above to console. But if any of my code calls a logger (e.g., logging.error("foo")) before I setup my handlers, the logging system will create a default logger that *also* emits logs, which I can't seem to get rid of. Is there a way I can suppress the creation...
0
7478
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, 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...
0
7668
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7923
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7437
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...
1
5343
isladogs
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...
0
3466
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...
0
3448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
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
0
722
bsmnconsultancy
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...

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.