473,478 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Create 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.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?
Jun 27 '08 #1
2 2137
On May 9, 12:51*pm, wurzelCidermaker
<wurzelCiderma...@discussions.microsoft.comwrote :
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?
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";
Jun 27 '08 #2

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

"Ignacio Machin ( .NET/ C# MVP )" wrote:
On May 9, 12:51 pm, wurzelCidermaker
<wurzelCiderma...@discussions.microsoft.comwrote :
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?

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";
Jun 27 '08 #3

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

Similar topics

2
2337
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...
4
4142
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...
1
2015
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')...
1
3647
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( )...
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' ...
4
1940
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,...
6
10217
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 ...
0
2081
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...
176
8179
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...
3
11508
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...
0
7027
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
6899
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
7067
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...
1
6719
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...
0
5312
agi2029
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,...
1
4757
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...
0
4463
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2980
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...
0
2970
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.