Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8630419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:03:37+00:00 2026-06-12T09:03:37+00:00

I just started using NLog and logging in general, but I find myself possibly

  • 0

I just started using NLog and logging in general, but I find myself possibly over abusing it. I am logging every single line of code, most of it is Info messages, but in my try catch scenarios or if something is null, I will log an error. What is the best thing to log?

I am using this for a WPF solution that has 2 projects (1 is the UI and the other is a Class library)

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <!-- make sure to set 'Copy To Output Directory' option for this file -->
  <!-- go to http://nlog-project.org/wiki/Configuration_file for more information -->

  <targets>
        <target name="errorLog" xsi:type="File" fileName="${basedir}/error.txt" />
      <target name="infoLog" xsi:type="File" fileName="${basedir}/info.txt" />
    </targets>

    <rules>
        <logger name="*" level="Error" writeTo="errorLog" />
      <logger name="*" level="Info" writeTo="infoLog" />
    </rules>
</nlog>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:03:38+00:00Added an answer on June 12, 2026 at 9:03 am

    NLog supports the concept of logging levels.

    It is a good idea to log anything that might be useful in tracking down why the program does what it does, using a level less than Error. Set the desired logging level to Error in NLog.config when you deploy your application.

    http://nlog-project.org/wiki/Log_Levels

    If a user experiences an unexpected problem, you can change the logging level to e.g. Info and get much more information about what is happening.

    Having said that, every single line of code is almost certainly overkill. You are cluttering your code with logging if you go to that extreme.

    Concentrate on places where things can go wrong in the application.

    My personal preference is to:

    • Use Trace level to indicate the flow of code (entering a method, exiting a method)
    • Use Info level to indicate progress / steps in key calculations
    • Use Error level to indicate something unexpected that the application can recover from
    • Use Fatal level to indicate that something really bad has happened and the app is about to shut down.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started using Eclipse but already I have a small problem. At first
I just started using mysqli API for PHP. Apparently, every time an object of
Just started using Blueprint CSS and now playing with the grids but have a
Just started using fadein/fadeout - it's functioning but with problems. I have a set
Just started using App Engine's webapp framework, but I can't figure out what's wrong
I just started using NLog in my asp.net application, and I need to see
I just started using Twitter Bootstrap http://twitter.github.com/bootstrap/scaffolding.html and I'm looking for the grey/blue navbar
I just started using rapidxml. I 1st create an xml file to read from.
I just started using Scala and Spec2. However, I'm a little bit confusing of
I just started using/learning Python and have some questions. I have a text file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.