Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

simple logging in a C# COM DLL

4 views
Skip to first unread message

wurzelCidermaker

unread,
May 9, 2008, 12:51:00 PM5/9/08
to
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.config] 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?

Ignacio Machin ( .NET/ C# MVP )

unread,
May 9, 2008, 2:40:13 PM5/9/08
to
On May 9, 12:51 pm, wurzelCidermaker

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.GetDirectoryName( Assembly.GetRunningAssembly().Location)
+ "\\log.config";

wurzelCidermaker

unread,
May 10, 2008, 5:47:00 AM5/10/08
to

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