Quick question about exception/error logging

  • Thread starter Thread starter csharper
  • Start date Start date
C

csharper

I am trying to use NLog for my applications. And I have statements
like below (faked examples only) in my code:

logger.Trace("My trace message");
logger.Debug("My debug message");
logger.Info("My information message");

For development, of course, this is very helpful, I can eyeball what
is going on in the application.

My question is: Will such ugly logging messages be output in
production?

Is it the case that such logger methods will only be executed when the
application is built for Debug and will be automatically suppressed if
I build my application for Release?

I don't think we need to comment out such logger statements for
production like in the ancient days, correct?

Kinda new to logging, please educate, thank you.
 
csharper said:
I am trying to use NLog for my applications. And I have statements
like below (faked examples only) in my code:

logger.Trace("My trace message");
logger.Debug("My debug message");
logger.Info("My information message");

For development, of course, this is very helpful, I can eyeball what
is going on in the application.

My question is: Will such ugly logging messages be output in
production?

Is it the case that such logger methods will only be executed when the
application is built for Debug and will be automatically suppressed if
I build my application for Release?

I don't think we need to comment out such logger statements for
production like in the ancient days, correct?

Kinda new to logging, please educate, thank you.

This is not a C# question - so you shouldn't be asking this here.

However, the idea is to leave such code in place and modify the output
through configuration changes.

Read the documentation:
http://nlog-project.org/wiki/Documentation
 
I am trying to use NLog for my applications. And I have statements
like below (faked examples only) in my code:

logger.Trace("My trace message");
logger.Debug("My debug message");
logger.Info("My information message");

For development, of course, this is very helpful, I can eyeball what
is going on in the application.

My question is: Will such ugly logging messages be output in
production?

Is it the case that such logger methods will only be executed when the
application is built for Debug and will be automatically suppressed if
I build my application for Release?

I don't think we need to comment out such logger statements for
production like in the ancient days, correct?

Kinda new to logging, please educate, thank you.

One of the main points in using a logging framework like this
is that the logging code is in the production code.

So if production encounter problems that require more information
to troubleshoot, then you can ask them to change the configuration
and lower the log threshold from warning to debug.

If you hard code writes, then you would need to release new
binaries.

Arne
 
Back
Top