Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

VB.Net Tracing....

Thread Tools
 
Search this Thread
 
Old 29 May 2002, 02:50 PM
  #1  
David_Wallis
Scooby Regular
Thread Starter
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

I have written a couple of services that run on one of our servers and I want to have a console app displaying the output / status of these... Can / should I use the trace function to do this?? or is this more for debugging purposes?

Anybody got any examples of how to do this? Preferably in Visual Basic .Net

David
Old 29 May 2002, 03:27 PM
  #2  
David_Wallis
Scooby Regular
Thread Starter
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

BTTT
Old 29 May 2002, 05:02 PM
  #3  
TopBanana
Scooby Regular
 
TopBanana's Avatar
 
Join Date: Jan 2001
Posts: 9,781
Likes: 0
Received 0 Likes on 0 Posts
Post

Well you could go to the hassle of extending the Tracing stuff, but then you'd have to use remoting between apps

Couldn't you just have the service open a console window? (Will have to set the service to allow interaction with desktop)
Old 29 May 2002, 06:27 PM
  #4  
David_Wallis
Scooby Regular
Thread Starter
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

not really as I want to be able to open the window whenever... not just when the service starts..

David
Old 29 May 2002, 06:33 PM
  #5  
TopBanana
Scooby Regular
 
TopBanana's Avatar
 
Join Date: Jan 2001
Posts: 9,781
Likes: 0
Received 0 Likes on 0 Posts
Post

So have an icon in the system tray
Old 29 May 2002, 09:37 PM
  #6  
IWatkins
Scooby Regular
 
IWatkins's Avatar
 
Join Date: Mar 2000
Location: Gloucestershire, home of the lawnmower.
Posts: 4,531
Likes: 0
Received 0 Likes on 0 Posts
Post

David,

No idea if this is of use, but I write a lot of services in Delphi. They have no interaction with the desktop at all (so users can't break them). But I also write a "control panel" for them that talks to the service via custom messages. In fact, the service also writes custom messages but if the "control panel" isn't running, nothing happens and the rest of the system ignores them. Works well in so much as if the "control panel" fails, gets knocked over etc. it doesn't take the service with it.

Wouldn't have a clue how to do this with .net, new fangled malarky

Cheers

Ian
Old 30 May 2002, 09:13 AM
  #7  
David_Wallis
Scooby Regular
Thread Starter
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

That is exactly what I want to do... Can you give an example of how you do this in delphi, as I know people that do both languages.

Its not that I dont want the service to open a window or have a system tray icon, its just that a service should have no interaction with the desktop really... it should just sit there and run.. If I was going to do it these ways there would be no point in writing it as a service...

David
Old 30 May 2002, 10:42 AM
  #8  
David_Wallis
Scooby Regular
Thread Starter
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

bttt
Old 30 May 2002, 11:17 AM
  #9  
Crispin
Scooby Regular
 
Crispin's Avatar
 
Join Date: Jan 2001
Posts: 534
Likes: 0
Received 0 Likes on 0 Posts
Post

David,

Did you write the services in .FRED? (I mean .NET) Or are they written in C++?
Old 30 May 2002, 11:21 AM
  #10  
MrDeference
Scooby Regular
 
MrDeference's Avatar
 
Join Date: Mar 2002
Posts: 337
Likes: 0
Received 0 Likes on 0 Posts
Post

Could write a tracing listener that writes to a log file?

EDIT: Or writes to the event log.

BTW : Remoting isn't difficult - if you want a walk down that path, I'll hold your hand

[Edited by MrDeference - 5/30/2002 11:24:41 AM]
Old 30 May 2002, 11:30 AM
  #11  
David_Wallis
Scooby Regular
Thread Starter
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

They are written in VB.net as thats my language... (to some extent)... How does remoting work? is it like a message queue?? Ideally I dont want to write to a file and it allready writes to the event log, but the status msgs could be every min, so didnt want to write all to the event log, and then have the app read from the event log, with some sort of filter....

I also had a stupid idea of being able to monitor it from another machine, but that was just being stupid!

Mr deference if you could that would be good...

Email me offline if you prefer

David

edited to add .net and remove email add.

[Edited by David_Wallis - 5/30/2002 11:32:19 AM]

[Edited by David_Wallis - 5/30/2002 11:55:31 AM]
Old 30 May 2002, 11:52 AM
  #12  
MrDeference
Scooby Regular
 
MrDeference's Avatar
 
Join Date: Mar 2002
Posts: 337
Likes: 0
Received 0 Likes on 0 Posts
Post

David,
YHM.


EDIT: The public part of this message reads : Remoting is the replacement for DCOM.

[Edited by MrDeference - 5/30/2002 11:53:49 AM]
Old 30 May 2002, 10:00 PM
  #13  
IWatkins
Scooby Regular
 
IWatkins's Avatar
 
Join Date: Mar 2000
Location: Gloucestershire, home of the lawnmower.
Posts: 4,531
Likes: 0
Received 0 Likes on 0 Posts
Post

Hi David,

Sorry, been on the road all day today.

Can it wait until the second half of next week ? I ask as I can't get to my source code until then

Cheers

Ian
Old 30 May 2002, 11:03 PM
  #14  
David_Wallis
Scooby Regular
Thread Starter
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

Yeah No probs.. I might be onto something at the moment... couldnt get it working today, think it might have been cos I was tired at work... going to give it my best shot tomorrow. Its annoying me...

Seems like as MrDeference said the way to do it is use remoting... This seems to talk across a tcp port... at the moment just pointing to localhost but this presents a lot better opportunities for me...

David
Old 31 May 2002, 09:21 AM
  #15  
TopBanana
Scooby Regular
 
TopBanana's Avatar
 
Join Date: Jan 2001
Posts: 9,781
Likes: 0
Received 0 Likes on 0 Posts
Post

Don't forget about security - the tcp channel listens on all interfaces for the given port. If you want to lock this down, you'll need to add a channel sink. I still reckon you should have done it the easy way , good learning opportunity I guess though!
Old 31 May 2002, 09:30 AM
  #16  
David_Wallis
Scooby Regular
Thread Starter
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

How to you do this, or do you just know that is what needs to be done.

David
Old 31 May 2002, 09:51 AM
  #17  
IWatkins
Scooby Regular
 
IWatkins's Avatar
 
Join Date: Mar 2000
Location: Gloucestershire, home of the lawnmower.
Posts: 4,531
Likes: 0
Received 0 Likes on 0 Posts
Post

David,

If you can get remoting working (I've never tried), that would give you better options with regards to having the 'console' on one machine and the service on another if I understand it correctly.

The method I use, is to broadcast messages within Windows after first registering a custom message. This will not work across a network as it uses the Windows message queue.

But I'll get something together for you next week anyway, you never know....

Cheers

Ian
Old 31 May 2002, 10:20 AM
  #18  
David_Wallis
Scooby Regular
Thread Starter
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

Cheers.

David
Old 31 May 2002, 12:18 PM
  #19  
TopBanana
Scooby Regular
 
TopBanana's Avatar
 
Join Date: Jan 2001
Posts: 9,781
Likes: 0
Received 0 Likes on 0 Posts
Post

David_Wallis: you don't *need* to sort out the security, but if you want to, I suggest you read up on adding a channel sink. What you do is effectively add an event handler to the chain on top of the remoting transport. You need to read up on remoting if you want to get it all to work
Old 31 May 2002, 12:20 PM
  #20  
David_Wallis
Scooby Regular
Thread Starter
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

looking at how much progress I'm making at the moment (not much) I think I may have to buy a decent book.. or move towards using C# as this seems the favoured language for remoting.

David
Old 31 May 2002, 02:39 PM
  #21  
IWatkins
Scooby Regular
 
IWatkins's Avatar
 
Join Date: Mar 2000
Location: Gloucestershire, home of the lawnmower.
Posts: 4,531
Likes: 0
Received 0 Likes on 0 Posts
Post

Another option I didn't think of...

Depending quite how much info you need, and the format of it, SysInternals may have what you need: http://www.sysinternals.com/ntw2k/fr...ebugview.shtml

Basically write a string to OutputDebugString (which is a basic API call). If nothing is there to hear it, nothing happens. However, if you fire this application up, setup filters and all the info. from your service will appear in this window.

I'd forgotten about this, but it is a tool I sometimes use for debugging stuff.

---------------------------------------------------------
The OutputDebugString function sends a string to the debugger for the current application.

VOID OutputDebugString(
LPCTSTR lpOutputString // pointer to string to be displayed
);

Parameters
lpOutputString
Points to the null-terminated string to be displayed.

Return Values
This function does not return a value.
---------------------------------------------------------

Looks as though this will work over a network too so might suit ozzy's problem as well. (I'll link in).

Cheers

Ian

[Edited by IWatkins - 5/31/2002 2:43:42 PM]
Old 31 May 2002, 03:11 PM
  #22  
MrDeference
Scooby Regular
 
MrDeference's Avatar
 
Join Date: Mar 2002
Posts: 337
Likes: 0
Received 0 Likes on 0 Posts
Post

Had some problems with that in the land of .NET. I don't think that System.Diagnostics.Trace uses OutputDebugString().
Old 31 May 2002, 03:38 PM
  #23  
David_Wallis
Scooby Regular
Thread Starter
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

the way I have got is working now... but I think there is something simple at fault... and with MrDeference's expert help Im sure ill get it sorted!

David
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
john banks
Non Scooby Related
3
15 November 2008 08:31 PM
SiDHEaD
Computer & Technology Related
16
27 August 2008 08:54 AM
Dracoro
Computer & Technology Related
13
14 May 2008 07:05 PM
midget1500
Computer & Technology Related
8
01 March 2005 10:27 PM



Quick Reply: VB.Net Tracing....



All times are GMT +1. The time now is 11:05 AM.