By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,781 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,781 IT Pros & Developers. It's quick & easy.

Java to C# question - Logging API and processor

P: n/a
Sam
I m trying to port a a Java app to C# and have two questions.

i) In Java there is a java.util.Logging package that can be used to log
at different levels. Is there an equivalent in C# ?

2) There is a Runtime.getRuntime.availableProcessors() method that
returns the number of available processors to the process.
How do I do that in C# ? I think I have to use a Win32 unmanaged API
call and can do that - but need some pointers on where I can find this info.

Thanks
/s
Mar 28 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
1) no. Not that I know of anyway, however there is a Trace log that is
easily usable. They are application specific and are set up in the
app.config file. They are often used for debugging, but not for real
logging. If you need to log events, use the EventLogger.

2) Environment.ProcessorCount. Use it like this:
int numProc = Environment.ProcessorCount;

Hope that helps.
jeremiah();

Sam wrote:
I m trying to port a a Java app to C# and have two questions.

i) In Java there is a java.util.Logging package that can be used to log
at different levels. Is there an equivalent in C# ?

2) There is a Runtime.getRuntime.availableProcessors() method that
returns the number of available processors to the process.
How do I do that in C# ? I think I have to use a Win32 unmanaged API
call and can do that - but need some pointers on where I can find this
info.

Thanks
/s

Mar 28 '06 #2

P: n/a
Thus wrote jeremiah,
1) no. Not that I know of anyway, however there is a Trace log that
is easily usable. They are application specific and are set up in the
app.config file. They are often used for debugging, but not for real
logging. If you need to log events, use the EventLogger.


Another option is Enterprise Library 2.0

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Mar 28 '06 #3

P: n/a
Sam <by******@phreaker.net> writes:
I m trying to port a a Java app to C# and have two questions.

i) In Java there is a java.util.Logging package that can be used to log
at different levels. Is there an equivalent in C# ?


Aside from the other mentioned built-in mechanisms you can also use
Log4Net, a straight-forward clone of log4j, also hosted by Apache:
http://logging.apache.org/log4net/

I am using it for most of my applications to get decent logging
support.

Best Regards,
Martin
Mar 29 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.