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

Logging in different thread ?

Hi,

Does someone has an example of logging in a different thread ? Native
Windows API had a mechanism to send thread message(which could be used to
send a message with log data details). Does .NET has an equivalent ?

Thanks in advance and regards

Navin
Jul 21 '05 #1
4 1905
"Navin Mishra" <Na**********@icn.siemens.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Hi,

Does someone has an example of logging in a different thread ? Native
Windows API had a mechanism to send thread message(which could be used to
send a message with log data details). Does .NET has an equivalent ?


..NET has several mechanisms you can use to communicate date between threads.
This data could certainly be logging data.

For example, you could use remoting, or a properly synchronized Queue, or
just about anything in between.

You might also write your logging code to be asynchronous, so that it's fast
enough that you don't need to explicitly use a separate thread.

John Saunders
Jul 21 '05 #2
Thanks. Is there any example ? That'd be great!

"John Saunders" <johnwsaundersiii at hotmail.com> wrote in message
news:OC**************@TK2MSFTNGP11.phx.gbl...
"Navin Mishra" <Na**********@icn.siemens.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Hi,

Does someone has an example of logging in a different thread ? Native
Windows API had a mechanism to send thread message(which could be used to
send a message with log data details). Does .NET has an equivalent ?


.NET has several mechanisms you can use to communicate date between
threads. This data could certainly be logging data.

For example, you could use remoting, or a properly synchronized Queue, or
just about anything in between.

You might also write your logging code to be asynchronous, so that it's
fast enough that you don't need to explicitly use a separate thread.

John Saunders

Jul 21 '05 #3
"Navin Mishra" <Na**********@icn.siemens.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Thanks. Is there any example ? That'd be great!
Sorry, I don't have an example of remoting or other simple inter-thread
communication.

John Saunders
"John Saunders" <johnwsaundersiii at hotmail.com> wrote in message
news:OC**************@TK2MSFTNGP11.phx.gbl...
"Navin Mishra" <Na**********@icn.siemens.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Hi,

Does someone has an example of logging in a different thread ? Native
Windows API had a mechanism to send thread message(which could be used
to send a message with log data details). Does .NET has an equivalent ?


.NET has several mechanisms you can use to communicate date between
threads. This data could certainly be logging data.

For example, you could use remoting, or a properly synchronized Queue, or
just about anything in between.

You might also write your logging code to be asynchronous, so that it's
fast enough that you don't need to explicitly use a separate thread.

John Saunders


Jul 21 '05 #4
Navin Mishra <Na**********@icn.siemens.com> wrote:
Does someone has an example of logging in a different thread ? Native
Windows API had a mechanism to send thread message(which could be used to
send a message with log data details). Does .NET has an equivalent ?


The simplest solution would be to just use a producer/consumer model.

See http://www.pobox.com/~skeet/csharp/t...eadlocks.shtml (second
half thereof) for an example.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #5

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

Similar topics

6
by: Ville Vainio | last post by:
Just posting this for the sake of google: Like everyone else, I figured it's time to start using the 'logging' module. I typically want to dump "info" level (and up) log information to...
16
by: Einar Høst | last post by:
Hi, I'm getting into the Trace-functionality in .NET, using it to provide some much-needed logging across dlls in the project we're working on. However, being a newbie, I'm wondering if some...
8
by: A.M | last post by:
Hi, What would be the best approach to log different items (SQL, Exceptions, Security, ...) I have a simple Logging function that adds log string to the end of a text file. Is there any...
4
by: Navin Mishra | last post by:
Hi, Does someone has an example of logging in a different thread ? Native Windows API had a mechanism to send thread message(which could be used to send a message with log data details). Does...
5
by: Dilip | last post by:
I have a tiny design question to ask. I am stuck with a home-brewed logging library that has different methods for logging messages based on severity (like warning, error, information etc.). ...
6
by: Dave | last post by:
I have a service that has 6 different threads. Each thread has a timer on it that elapses at about the same time (if not the same time). When the timer elapses I am trying to log a message by...
3
by: Ross Boylan | last post by:
I would like my different threads to log without stepping on each other. Past advice on this list (that I've found) mostly says to send the messages to a Queue. That would work, but bypasses...
2
by: ZHENG Zhong | last post by:
Hi, I implemented a small logging library with the API like this: logger& log = log_manager::instance().get_logger("my_logger"); log.stream(DEBUG) << "this is a debug message" << std::endl;...
6
by: Larry Bates | last post by:
Every time I look at the logging module (up until now) I've given up and continue to use my home-grown logger that I've been using for years. I'm not giving up this time ;-) I find that I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.