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

How to log Console.WriteLine output

Hi.

I'm new to VS.NET 2008 and WCF development (.NET 3.5).
I'm developing a WebService prototype. I would like to use Console.WriteLine
(or similar) to log some information I need for future development /
troubleshooting. Unfortunately I didn't figure out the way to log the output
to a file.

I spent few hours studying and trying out the web.config ->
system.diagnostics, but I figured out it is not meant to be used for what I'm
looking for - maybe I'm mislead and I just don't know how to use it.
I also found Apache Log4Net that is supposed to address my needs; however, I
would like to avoid using a 3rd party library just for simple logging - there
should be a simple way to do it in .NET.

Can someone point me to the solution? :)

Thanks,
Damir Dezeljin
Jul 5 '08 #1
3 1554

"Damir Dezeljin" <De**@noemail.noemailwrote in message
news:18**********************************@microsof t.com...
Hi.

I'm new to VS.NET 2008 and WCF development (.NET 3.5).
I'm developing a WebService prototype. I would like to use
Console.WriteLine
(or similar) to log some information I need for future development /
troubleshooting. Unfortunately I didn't figure out the way to log the
output
to a file.

I spent few hours studying and trying out the web.config ->
system.diagnostics, but I figured out it is not meant to be used for what
I'm
looking for - maybe I'm mislead and I just don't know how to use it.
I also found Apache Log4Net that is supposed to address my needs; however,
I
would like to avoid using a 3rd party library just for simple logging -
there
should be a simple way to do it in .NET.

Can someone point me to the solution? :)
You can just use the eventlog, by creating it on the fly and then using it.
The eventlog which should be created as an Application Eventlog on a NT
based O/S can be viewed with the Event viewer on another machine across the
LAN. I have done this with Console and NT Service application, and I don't
see why you couldn't do it with a WCF solution.

The example is in VB.Net but you can do the same thing in C#.Net

http://www.codeguru.com/columns/vb/article.php/c6561/

Jul 6 '08 #2
Thanks Arnold.

Anyway ... EventLogging isn't really what I'm looking for. Well, it can be
used as a first solution; however, I'm still looking for a solution to easily
log to files like e.g. I do by using log4j with Axis2 web services.

Any other hint? Or at least can someone tell me if it is at least possible
do it in .NET C#?

Sincerely,
Damir
Jul 9 '08 #3

"Damir Dezeljin" <De**@noemail.noemailwrote in message
news:06**********************************@microsof t.com...
Thanks Arnold.

Anyway ... EventLogging isn't really what I'm looking for. Well, it can be
used as a first solution; however, I'm still looking for a solution to
easily
log to files like e.g. I do by using log4j with Axis2 web services.

Any other hint? Or at least can someone tell me if it is at least possible
do it in .NET C#?
Doesn't Application Blocks for .Net have a logging functionality, use Google
look it up?

Jul 10 '08 #4

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

Similar topics

1
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
7
by: shawnk | last post by:
Hello Everyone How do you format format numbers right-justified using Console.WriteLine(), i.e I need to line up numbers in vertical columns and the MSDN documentation is pretty poor Here is the...
7
by: ajikoe | last post by:
Hello All, It is said that : Enabling the console window is easy. From Microsoft Visual Studio®, right-click on the project and choose Properties. Change the output type from Windows Application...
12
by: newsgroupie | last post by:
Hi Newsgroupies, I'm writing a Web Forms program using C# (VS.NET 2003) and trying to monitor it whilst running using "System.Console.WriteLine(<params>)" but can't for the life of me find where...
3
by: Roy Gourgi | last post by:
Hi, How would I set the width of lnSize to 6 in the statement Console.WriteLine("Size of {0} ", lnSize); Furthermore is there a way to combine these 3 statements into 1 ...
5
by: portroe | last post by:
Hi I am using console.Writeline in my simple program. I do not however see anything happening in the output window when I debug, there are also no error messages, Has anybody a tip on what...
12
by: Jarod_24 | last post by:
I got a project called "Forms" that hold some forms and stuff in my solution. A argument at startup defines wether to use a From or Console. My plan was to create a myConsole class that would...
4
by: Bob | last post by:
I just recently noticed that when I start my applicatoin in debug mode, the IDE hangs (no disk or CPU activity) indefinitely (at least 20 minutes). Pausing the application shows that it's hung up...
3
by: Andrew Ducker | last post by:
We were using Console.Writeline from within our app, to do some routine debugging. And then we started having random problems when the code was run by a tester, on their own machine. We...
2
by: djc | last post by:
out of all the overloads that pop up via intellisense for console.writeline() the following one confuses me: Console.WriteLine (string format, params object arg) 1) whats the deal with...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.