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

Java to C# question - Logging API and processor

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
3 3650
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: BlackHawke | last post by:
Hello! This is my second post. Ppl really helped me with the first. I hope there are answers for this one as well I own a game company (www.aepoxgames.net) releasing the beta for our first...
0
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what...
1
by: greg.knaddison | last post by:
Hi, I'm trying to use the httpclient within Jython (see http://jakarta.apache.org/commons/httpclient/ for more information on the httpclient). My Jython version is: Jython 2.1 on...
133
by: Gaurav | last post by:
http://www.sys-con.com/story/print.cfm?storyid=45250 Any comments? Thanks Gaurav
235
by: napi | last post by:
I think you would agree with me that a C compiler that directly produces Java Byte Code to be run on any JVM is something that is missing to software programmers so far. With such a tool one could...
7
by: Alex | last post by:
Hi all, I am trying to install a java stored procedure via the windows development centre. The linux box is running 8.1 FP4 as is the windoze platform. If I am on the linux box i can install...
2
by: Michael | last post by:
Running DB2 v7 UDB ("DB2 v7.1.0.93", "n031208" and "WR21333") on Windows XP, I am unable to find out why the "Build for Debug" option within Stored Procedure Builder is not enabled on Java stored...
0
oll3i
by: oll3i | last post by:
package library.common; import java.sql.ResultSet; public interface LibraryInterface { public ResultSet getBookByAuthor(String author); public ResultSet getBookByName(String name);
1
by: henrymania | last post by:
Am writing a code for database backup....by backupservlet is as given below i get the following exception
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.