Click here to Skip to main content
15,895,799 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: TWCP OTD (The Who Cares Puzzle Of The Day) - 26th of January, 2017 Pin
Kornfeld Eliyahu Peter26-Jan-17 10:05
professionalKornfeld Eliyahu Peter26-Jan-17 10:05 
GeneralRe: TWCP OTD (The Who Cares Puzzle Of The Day) - 26th of January, 2017 Pin
Ian Shlasko26-Jan-17 10:11
Ian Shlasko26-Jan-17 10:11 
GeneralRe: TWCP OTD (The Who Cares Puzzle Of The Day) - 26th of January, 2017 Pin
jsc4227-Jan-17 4:49
professionaljsc4227-Jan-17 4:49 
GeneralRe: TWCP OTD (The Who Cares Puzzle Of The Day) - 26th of January, 2017 Pin
Chris C-B26-Jan-17 19:58
Chris C-B26-Jan-17 19:58 
GeneralRe: TWCP OTD (The Who Cares Puzzle Of The Day) - 26th of January, 2017 Pin
englebart27-Jan-17 2:21
professionalenglebart27-Jan-17 2:21 
GeneralRe: TWCP OTD (The Who Cares Puzzle Of The Day) - 26th of January, 2017 Pin
Kornfeld Eliyahu Peter28-Jan-17 6:24
professionalKornfeld Eliyahu Peter28-Jan-17 6:24 
GeneralRe: TWCP OTD (The Who Cares Puzzle Of The Day) - 26th of January, 2017 Pin
Mark_Wallace26-Jan-17 22:44
Mark_Wallace26-Jan-17 22:44 
General.Net Logging PinPopular
Kevin Marois26-Jan-17 7:19
professionalKevin Marois26-Jan-17 7:19 
So I'm looking at NLog and Log4net. Why in the world does logging need to be so blasted complicated???

Now I'm sure some of you would say "Log4Net or NLog isn't complicated", but at the most basicl level, what's wrong with this:
public class Logger
{
    public static string LogFile { get; set; }

    static Logger()
    {
        if (string.IsNullOrEmpty(LogFile))
        {
            var path = System.Reflection.Assembly.GetEntryAssembly().Location;
            LogFile = string.Format("{0}\MyLogFile.txt", path);
        }
    }

    public static void Info(string message)
    {
        using (var sr = new StreamWriter(LogFile, true))
        {
            sr.WriteLine(message);
        }
    }
}

I've never understood why This Much is needed just to write to a silly log file. Seems to me that these "tools" are just a solution looking for a problem.

IMHO, WAY WAY WAY over-engineered.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

GeneralRe: .Net Logging Pin
Bassam Abdul-Baki26-Jan-17 7:22
professionalBassam Abdul-Baki26-Jan-17 7:22 
GeneralRe: .Net Logging Pin
Kevin Marois26-Jan-17 7:23
professionalKevin Marois26-Jan-17 7:23 
GeneralRe: .Net Logging Pin
PIEBALDconsult26-Jan-17 7:30
mvePIEBALDconsult26-Jan-17 7:30 
GeneralRe: .Net Logging Pin
Kevin Marois26-Jan-17 7:31
professionalKevin Marois26-Jan-17 7:31 
GeneralRe: .Net Logging Pin
PIEBALDconsult26-Jan-17 7:46
mvePIEBALDconsult26-Jan-17 7:46 
GeneralRe: .Net Logging Pin
TheGreatAndPowerfulOz26-Jan-17 8:48
TheGreatAndPowerfulOz26-Jan-17 8:48 
GeneralRe: .Net Logging Pin
BinaryReason27-Jan-17 1:37
BinaryReason27-Jan-17 1:37 
GeneralRe: .Net Logging Pin
den2k8827-Jan-17 1:40
professionalden2k8827-Jan-17 1:40 
GeneralRe: .Net Logging Pin
Middle Manager27-Jan-17 6:23
Middle Manager27-Jan-17 6:23 
GeneralRe: .Net Logging Pin
BinaryReason16-Feb-17 2:11
BinaryReason16-Feb-17 2:11 
GeneralRe: .Net Logging Pin
Nish Nishant26-Jan-17 7:44
sitebuilderNish Nishant26-Jan-17 7:44 
GeneralRe: .Net Logging Pin
Jeremy Falcon26-Jan-17 8:33
professionalJeremy Falcon26-Jan-17 8:33 
GeneralRe: .Net Logging Pin
Nish Nishant26-Jan-17 8:40
sitebuilderNish Nishant26-Jan-17 8:40 
GeneralRe: .Net Logging Pin
Jeremy Falcon26-Jan-17 8:45
professionalJeremy Falcon26-Jan-17 8:45 
GeneralRe: .Net Logging Pin
PIEBALDconsult27-Jan-17 2:46
mvePIEBALDconsult27-Jan-17 2:46 
GeneralRe: .Net Logging Pin
Jeremy Falcon27-Jan-17 5:52
professionalJeremy Falcon27-Jan-17 5:52 
GeneralRe: .Net Logging Pin
EbenRoux30-Jan-17 0:59
EbenRoux30-Jan-17 0:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.