473,411 Members | 1,918 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,411 software developers and data experts.

Tracing Execution in Class Library

I have an ASP.NET and a Windows Forms Application which both use a shared
class library.

Is there a way which I can use the Trace Object in the class library so that
I can get Trace Output sent to Trace.AXD when using it with the ASP.NET
Application?

I have inserted a number of Trace Statements, but they send output to the
Visual Studio output window instead of the Trace.AXD output. If I put a
Trace statement in a Web Page then I can get the output where I want it.

I guess I need to use the System.Web.Trace object rather than the
System.Diagnostics.Trace, but this needs an HTTPContext, which I cannot see
how to get. I also don;t want to break compatibility with the Windows Forms
application.

Am I heading in the right direction?

Thanks
Graham Cottle
Nov 18 '05 #1
1 1450
if you know the file you wish to write to, why stick to the trace class?

you could do something like

LogTrace ( string szMyString )
{
StreamWriter wrter = File.AppendText ( "myOutputFile.txt" );
wrter.WriteText ( szMyString );
wrter.Flush();
wrter.Close;
}

then call this function from where ever you want and you're doing
essentially the same thing.

hope that helps.

Daniel.
"Graham Cottle" <gc*****@kcc.nospam.com> wrote in message
news:O8*************@TK2MSFTNGP10.phx.gbl...
I have an ASP.NET and a Windows Forms Application which both use a shared
class library.

Is there a way which I can use the Trace Object in the class library so that
I can get Trace Output sent to Trace.AXD when using it with the ASP.NET
Application?

I have inserted a number of Trace Statements, but they send output to the
Visual Studio output window instead of the Trace.AXD output. If I put a
Trace statement in a Web Page then I can get the output where I want it.

I guess I need to use the System.Web.Trace object rather than the
System.Diagnostics.Trace, but this needs an HTTPContext, which I cannot see
how to get. I also don;t want to break compatibility with the Windows Forms
application.

Am I heading in the right direction?

Thanks
Graham Cottle

Nov 18 '05 #2

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

Similar topics

6
by: Patrick | last post by:
Following earlier discussions about invoking a .NET class library via ..NET-COM Interop (using regasm /tlb) at...
2
by: Brett | last post by:
I had a developer send me a VB.NET class library that was developed in Visual Studio .NET v1.0. I loaded the VB project and Visual Studio ..Net v1.1 and I converted the project to v1.1. I...
3
by: Chua Wen Ching | last post by:
Hi there, I had applied this security permissions in my class library based on fxcop standards. Before namespace: using System.Runtime.InteropServices; using System.Security.Permissions;
0
by: tony | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. In this user control we have a class...
0
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something...
0
by: Sek | last post by:
Gurus, I have a typical situation. I have a class library in C# having some core functionality. I want to use Trace feature in this. I noticed that, i can't use TraceSwitch option as it is...
3
by: Andrew | last post by:
I have a class library that has app.config that has <system.diagnostics> that specifies trace listeners. The class library is loaded by a third party unmanaged application. I want the .NET...
16
by: Rainer Queck | last post by:
Hi, What would be the best way to develop a class library? I am planing to develop a couple of classes, needed in our company enviroment. These classe will be later used in several projects. ...
0
by: IanWright | last post by:
Right, here goes. I'm designing a class library that runs a heuristic on several threads and therefore has to be thread safe. I'm going to outline the current design in a second, but I'm not sure...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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,...
0
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...

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.