Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. .Net Logging

.Net Logging

Scheduled Pinned Locked Moved The Lounge
csharphelptoolstutorialquestion
51 Posts 34 Posters 55 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Mladen Jankovic

    Sander Rossel wrote:

    since when is a log file easier for debugging than a friggin' debugger!?

    Since the moment your code hits production, and you cannot attach debugger to live system.

    GeoGame for Windows Phone | The Lounge Explained In 5 Minutes

    Sander RosselS Offline
    Sander RosselS Offline
    Sander Rossel
    wrote on last edited by
    #30

    Personally, I've never needed to debug live systems. Well, once... Because my logger failed! Really, the software worked as expected, except for the logging :~ All the other times an exception log sufficed to fix the problem :)

    Best, Sander arrgh.js - Bringing LINQ to JavaScript SQL Server for C# Developers Succinctly Object-Oriented Programming in C# Succinctly

    1 Reply Last reply
    0
    • K Kevin Marois

      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](https://csharp.today/log4net-tutorial-great-library-for-logging/) 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.

      X Offline
      X Offline
      Xmen Real
      wrote on last edited by
      #31

      Finally someone said what I felt. I ended up making my own way simpler logger than using the prebuilt ones. They were supposed to be easy, but no, you have to spend way too much time on learning their API and structure.

      TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>

      ----------------------------------------------- 128 bit encrypted signature, crack if you can

      1 Reply Last reply
      0
      • K Kevin Marois

        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](https://csharp.today/log4net-tutorial-great-library-for-logging/) 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.

        J Offline
        J Offline
        Johann Gerell
        wrote on last edited by
        #32

        Nothing is wrong with that "at the most basic level", but when you're in a heavily multithreaded/concurrent/async/parallel environment with extreme demands for low latency and high throughput, you need a logging system that doesn't negatively affect the required functionality of the application, doesn't block anything, and doesn't garble data due to likely concurrent logging resource access. As your basic example is written, it will surely "work" for most simple desktop user scenarios where the time it takes for the user to make a mouse click is 10 times higher than the time to complete a call to Logger::Info(), and nothing complicated is happening concurrently. That said, it would *never* work in a game, in a VoIP app, in a high-grequency stock trading app.

        Time you enjoy wasting is not wasted time - Bertrand Russel

        1 Reply Last reply
        0
        • P PIEBALDconsult

          Logging frameworks (etc.) are for developers who are too stupid to figure it out for themselves. If you're smart enough to recognize that the framework is crap, you don't need that framework. :cool:

          B Offline
          B Offline
          BinaryReason
          wrote on last edited by
          #33

          Are you seriously suggesting re-inventing the wheel?

          "There are only 10 types of people in the world - those who know binary and those who don't."

          D 1 Reply Last reply
          0
          • K Kevin Marois

            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](https://csharp.today/log4net-tutorial-great-library-for-logging/) 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.

            B Offline
            B Offline
            BinaryReason
            wrote on last edited by
            #34

            You're doing something wrong. With NLog, all you need to do is include a nlog.config file in your project, and then to log you simply do the following:

            static Logger _logger = LogManager.GetCurrentClassLogger();

            _logger.Log(LogLevel.Info, "Your message");

            "There are only 10 types of people in the world - those who know binary and those who don't."

            1 Reply Last reply
            0
            • B BinaryReason

              Are you seriously suggesting re-inventing the wheel?

              "There are only 10 types of people in the world - those who know binary and those who don't."

              D Offline
              D Offline
              den2k88
              wrote on last edited by
              #35

              Same old argument. If the existing wheels don't fit your needs you create the right wheels. A developer who doesn't do as much isn't worth a dime - baceause creating tools is precisely programmers' work.

              CALL APOGEE, SAY AARDWOLF GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver "Go ahead, make my day"

              M B 2 Replies Last reply
              0
              • K Kevin Marois

                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](https://csharp.today/log4net-tutorial-great-library-for-logging/) 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.

                M Offline
                M Offline
                Marc Clifton
                wrote on last edited by
                #36

                Logging to a text file is obsolete. [PaperTrailApp](https://papertrailapp.com/). ;) I use this pretty much exclusively nowadays, writing to it over UDP is trivial:

                byte[] buffer = Encoding.ASCII.GetBytes(message);
                socket.SendTo(buffer, endPoint);

                And it's been really helpful to be able to view logs from anywhere. If it's at all interesting to you. :) Marc

                V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                1 Reply Last reply
                0
                • K Kevin Marois

                  Agreed. I just threw that in there for illustrative purposes

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

                  H Offline
                  H Offline
                  Howard Hoffman 0
                  wrote on last edited by
                  #37

                  IMO there are at least 2 advantages to those frameworks: - Separating the decision of what to log from the decision of "where" to place the log - Allowing you to change your mind post installation (via a watched external config file) Been using both web systems for almost 20 years. I've been continually glad for the ability to diagnose problems in the field in a straightforward way using mechanisms that are publicly documented and widely understood. Countless real bugs have been quickly identified and resolved thanks to this instrumentation.

                  1 Reply Last reply
                  0
                  • K Kevin Marois

                    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](https://csharp.today/log4net-tutorial-great-library-for-logging/) 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.

                    J Offline
                    J Offline
                    JackPeacock
                    wrote on last edited by
                    #38

                    What happens when you start the second instance of the program? What happens when you run it as a service? How do you look at the log remotely, while the program is running locally? Windows already has event logging that work well, using WMI. Remotely accessible, fits in with enterprise operations management frameworks, no file droppings in local directories, no need to reinvent the wheel. Log4Net et al. are solutions that fit problems when logging expands to larger enterprise systems. Silly log files quickly break down when complexity increases.

                    1 Reply Last reply
                    0
                    • J Jeremy Falcon

                      Nish Nishant wrote:

                      That said, some of these logging frameworks kept adding features and now are unnecessarily complex, and may have reached a saturation point of over-engineering.

                      Adobe is doing the same thing with Photoshop now. I hope it doesn't get worse, that's been one of my favorite apps for so many years. If it goes to crap it'll be a sad, sad day for computerland. :((

                      Jeremy Falcon

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #39

                      I still use PhotoShop 7 (2002) -- it has never suddenly changed how it works. Nor has Office 2003.

                      J E 2 Replies Last reply
                      0
                      • K Kevin Marois

                        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](https://csharp.today/log4net-tutorial-great-library-for-logging/) 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.

                        M Offline
                        M Offline
                        Michael Shoemaker
                        wrote on last edited by
                        #40

                        I AGREE 10,000% !!!! Excellent post! I did pretty much exactly what you did.. I looked at those logger and went "WTF.. this is WAY overcomplicated so I wrote something MUCH simpler very similar to yours.

                        1 Reply Last reply
                        0
                        • K Kevin Marois

                          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](https://csharp.today/log4net-tutorial-great-library-for-logging/) 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.

                          S Offline
                          S Offline
                          ScottM1
                          wrote on last edited by
                          #41

                          I used Log4Net a while back but I thought at the time that it seemed to be overkill for what I wanted it to do. Glad I'm not the only one.

                          1 Reply Last reply
                          0
                          • K Kevin Marois

                            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](https://csharp.today/log4net-tutorial-great-library-for-logging/) 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.

                            R Offline
                            R Offline
                            ranman22
                            wrote on last edited by
                            #42

                            Funny co-incidence! I _just_ got done dealing with existing log4net code that wasn't set up to work with multiple threaded entities (the way it was being used in our project) ...so my choices were to: 1) learn the overly complex log4net API and add add even more external dependencies to our several DLLs that were using it 2) write about 30 lines of code to create a thread safe generic logging API that did the same thing ...I saved a bunch of time and removed an external dependency by going with option 2 :)

                            1 Reply Last reply
                            0
                            • K Kevin Marois

                              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](https://csharp.today/log4net-tutorial-great-library-for-logging/) 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.

                              J Offline
                              J Offline
                              James Curran
                              wrote on last edited by
                              #43

                              The problem really isn't with the logger, but with the documentation (and I'm including article here on CodePRoject in that). For log4net (and for most other loggers, and most add-in libraries in general for that matter), there are: - things you do every time you want to log something. - things you do once for every class which logs something. - things you do once for each application which logs something. - things you do once in your lifetime. To understand how you use the logger, they should be explained in that order -- the thing you do the most taught first and with the most text. However, most go with a chronologic order -- exactly the reverse -- so you are bogged down with pages & pages of "configuration" documentation --- which in a real application will result one line of code.

                              Truth, James

                              1 Reply Last reply
                              0
                              • P PIEBALDconsult

                                I still use PhotoShop 7 (2002) -- it has never suddenly changed how it works. Nor has Office 2003.

                                J Offline
                                J Offline
                                Jeremy Falcon
                                wrote on last edited by
                                #44

                                Oh snap. :-D

                                Jeremy Falcon

                                1 Reply Last reply
                                0
                                • D den2k88

                                  Same old argument. If the existing wheels don't fit your needs you create the right wheels. A developer who doesn't do as much isn't worth a dime - baceause creating tools is precisely programmers' work.

                                  CALL APOGEE, SAY AARDWOLF GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver "Go ahead, make my day"

                                  M Offline
                                  M Offline
                                  Middle Manager
                                  wrote on last edited by
                                  #45

                                  Totally agree. Nothing wrong with using 3rd party code or frameworks but no one shoudl be afraid to roll up their sleeves and make it themselves if the need fits.

                                  1 Reply Last reply
                                  0
                                  • K Kevin Marois

                                    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](https://csharp.today/log4net-tutorial-great-library-for-logging/) 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.

                                    M Offline
                                    M Offline
                                    marcus obrien
                                    wrote on last edited by
                                    #46

                                    I think its been mentioned before but this is ok if you have a single thread running. Any GUI based app with more than the main thread is going to be problematic. Loggin shouldn't be wasting time on the main thread running the program. You should wrap up a logging task, then fire it off onto another thread and forget about it. It can take ages (relatively) to open a file and append a log entry to it. And if you use locking (mutex) to make sure logging is thread safe, then all the threads wanting to log, end up waiting etc. Then there is the problem of multiple teams/modules writing to the log. It's nice to filter/partition log entries etc. Or use colour coding (then you need a log file reader !) So at home on my robotics projects (www.roboticsfordreamers.com) I use a simple - file open and writer - for simple projects (I always use small simple programs linked together with 0MQ anyway, so logging is always on a separate single thread !) I do agree though, that mostly this area is over-engineered, the people who look after these projects see them as in need of improving with additional functionality. What is nice, is when you have two approaches you can use in a software system. The super fast, lightweight, low functionality solution, and the complete bells and whistles solution. Maybe software (especially SDKs) should be developed in this way, then users can chose the trade off between functionality and speed.

                                    1 Reply Last reply
                                    0
                                    • K Kevin Marois

                                      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](https://csharp.today/log4net-tutorial-great-library-for-logging/) 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.

                                      O Offline
                                      O Offline
                                      obermd
                                      wrote on last edited by
                                      #47

                                      My LogFile class is 160 lines of VB.Net code. I also have equivalents in VB6 and C++. This gives me a uniform LogFile class that supports automatic day rollover and log file names.

                                      1 Reply Last reply
                                      0
                                      • K Kevin Marois

                                        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](https://csharp.today/log4net-tutorial-great-library-for-logging/) 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.

                                        E Offline
                                        E Offline
                                        EbenRoux
                                        wrote on last edited by
                                        #48

                                        I have a simple logging interface that I use: Shuttle.Core.Infrastructure/Shuttle.Core.Infrastructure/Logging at master · Shuttle/Shuttle.Core.Infrastructure · GitHub[^] I also have a Log4Net implementation: GitHub - Shuttle/Shuttle.Core.Log4Net: Log4Net ILog implementation.[^] I like Log4Net but with the logging abstracted away you can use anything from simple to advanced.

                                        1 Reply Last reply
                                        0
                                        • P PIEBALDconsult

                                          I still use PhotoShop 7 (2002) -- it has never suddenly changed how it works. Nor has Office 2003.

                                          E Offline
                                          E Offline
                                          EbenRoux
                                          wrote on last edited by
                                          #49

                                          I recently came across instructions showing one how to legally download Photoshop CS2 along with it's key :) I don't currently need anything more advanced than that. The short version is to create an account on the Adobe site, search for CS2 and download with key...

                                          P 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups