Computer data logging is the process of recording events in a computer program, usually with a certain scope, in order to provide an audit trail that can be used to understand the activity of the system and to diagnose problems.

learn more… | top users | synonyms

45
votes
9answers
4k views

What are some patterns and anti-patterns of application logging? [closed]

I recently had to investigate a field issue for our large enterprise application. I was horrified by the logs that I had to comb through in an attempt to find the problem and at the end of the day the ...
37
votes
9answers
4k views

Do we need Logging when doing TDD?

When doing the Red, Green & Refactor cycle we should always write the minimum code to pass the test. This is the way I have been taught about TDD and the way almost all books describe the process. ...
32
votes
2answers
15k views

Best practices for logging and tracing in .NET

I've been reading a lot about tracing and logging, trying to find some golden rule for best practices in the matter, but there isn't any. People say that good programmers produce good tracing, but put ...
24
votes
11answers
4k views

Logging: Why and What? [closed]

I've never written programs which make significant use of logging. The most I've done is to capture stack traces when exceptions happen. I was wondering, how much do other people log? Does it depend ...
18
votes
4answers
7k views

What is the correct way to handle debug output in Java?

As my current Java projects grow bigger and bigger, I feel a likewise growing need to insert debug output in several points of my code. To enable or disable this feature appropriately, depending on ...
18
votes
6answers
38k views

Why doesn't “object reference not set to an instance of an object” tell us which object?

We're launching a system, and we sometimes get the famous exception NullReferenceException with the message Object reference not set to an instance of an object. However, in a method where we have ...
18
votes
2answers
875 views

Should You Log From Library Code?

If I am developing a Java library, is it good practice to issue log statements from within the library's code? Having logging within the library will make debugging and troubleshooting more ...
13
votes
2answers
1k views

Is it more sensible to log exceptions in a catch-all or in a base exception class?

I'm in the process of refactoring a fairly large web app. One of the major issues is inconsistent error handling and I'm trying to come up with a sensible strategy. I've created a custom error ...
12
votes
6answers
2k views

What's the best way to manage error logging for exceptions?

Introduction If an error occurs on a website or system, it is of course useful to log it, and show the user a polite message with a reference code for the error. And if you have lots of systems, you ...
11
votes
5answers
691 views

When to start writing Exception Handling, Logging

When do you start writing your Exception Handling Code? When do you start writing Logging Statements. For the purpose of elaborating this question, let us assume that we are on .NET platform with ...
11
votes
7answers
2k views

From a design perspective, what are the best practices for logging? [closed]

I want to add logging to an application I'm currently working on. I've added logging before, that's not an issue here. But from a design perspective in an object-oriented language, what are the best ...
10
votes
6answers
1k views

Need to make my code more readable to the other programers in my team

I am working a project in delphi 7 and I am creating a installer for the application, there are Three main parts. PostgreSQL installation/uninstallation myapplication ( setup of myapplication is ...
9
votes
7answers
12k views

Best practices for logging user actions in production

I was planning on logging a lot of different stuff in my production environment, things like when a user: Logs In, Logs Off Change Profile Edit Account settings Change password ... etc Is this a ...
7
votes
11answers
690 views

Is it practical to use Twitter for service logs?

Recently my boss suggested that we post logs of our service that is hosted on Windows Azure into twitter. His idea is that it's conveniently readable and if Azure cloud fails logs persist. He also ...
7
votes
2answers
527 views

Concurrency pattern of logger in multithreaded application

The context: We are working on a multi-threaded (Linux-C) application that follows a pipeline model. Each module has a private thread and encapsulated objects which do processing of data; and each ...
7
votes
5answers
304 views

Is there a pattern or logical structure I can follow for Event Log Numbers?

What are some ideas or structure I can use when assigning EventID to events that will be saved to the Windows Event Log? Some options I've considered Sequential (0... int.Max) Multiple of ...
7
votes
2answers
439 views

How should I handle logging when I create libraries for others?

All. I am creating some libraries for other teams in my company. They all have different logging mechanisms. I want to provide trace information of what my libraries are doing. What should I to ...
6
votes
3answers
2k views

Exception Handling Frequency/Log Detail

I am working on a fairly complex .NET application that interacts with another application. Many single-line statements are possible culprits for throwing an Exception and there is often nothing I can ...
6
votes
4answers
361 views

Logging errors caused by exceptions deep in the application

What are best-practices for logging deep within an application's source? Is it bad practice to have multiple event log entries for a single error? For example, let's say that I have an ETL system ...
6
votes
3answers
260 views

Multitasking how to keep track of what you're doing

I'm in a long debugging task, I need to figure out where to hook up some extra functionality I need. It's cumbersome work, and I've been debugging 2 whole days, and I'm on my third, but I work in ...
6
votes
6answers
1k views

Rules and advice for logging?

In my organization we've put together some rules / guildelines about logging that I would like to know if you can add to or comment. We use Java but you may comment in general about loggin - rules ...
5
votes
2answers
504 views

How should I handle logger failures?

In several of our company's applications, we use a custom logger. It's fairly robust, though we may replace it with something like NLog in the future. One of the logger's tasks is to log any ...
5
votes
4answers
321 views

Is it normal to write all logs into a single file?

Our teamlead said that many files much worse than a single, despite of we are working on a big project. He argued that our customers could more easily send logs to us if there will be just a single ...
5
votes
1answer
148 views

Log to file or to database table?

I'm developing a web application which uses MS SQL for various data: including users, user accounts, user licenses, license prices, invoices. I need to log users' real-time usage of the system, and ...
5
votes
2answers
212 views

Is it fine to use logs in the Helper Methods?

I have been doubting for a long time whether or not to have a logger in methods (usually helper methods) like the one below. Whether we can print it in the method or print the response where the ...
5
votes
2answers
391 views

Logging in JSON Effect on Performance

I see more and more articles about logging in JSON. You can also find one on NodeJS blog. Why does everyone like it so much? I can only see more operations getting involved: A couple new objects ...
5
votes
3answers
313 views

What should I do with production error logs?

We have a PHP intranet site that we run with warning/error logging on (as it's not under heavy load and there's a number of bugs/bad code left to find). Because the site is relatively unstable and in ...
5
votes
5answers
300 views

Where to position logging statements

I have the following classes : class Task { public void DoSomething() { var s = new Service(); s.First(); s.Second(); s.Third(); } } class Service { ...
5
votes
2answers
159 views

Database Change Auditing - Part of or Abstracted from ORM / Application Layer?

My fellow developers and I are at a crossroads in how to go about continuing our auditing of database changes. Most of our applications log changes via INSERT, UPDATE, and DELETE triggers. A few of ...
4
votes
13answers
778 views

Logging, do you do it? [closed]

Back on my theme of late: interview questions. Was recently asked to describe a time I'd used logging. My first instinct was to respond with compiler warnings set to full and error-out. What he was ...
4
votes
2answers
271 views

Is ok to leave untranslated advanced log?

I just had a little fight with my boss over this topic (well, the boss always wins so I will do what he wants to be done) but I'd like to have the opinion of others about this: We are making a ...
4
votes
4answers
303 views

Do you run production boxes with logs completely turned off?

We are internally debating in our team if we should continue to run our production boxes with logs turned off completely and just log errors and exceptions with log rotations. I want to know how ...
4
votes
2answers
443 views

How much logging should I do at production for SQLExcpetions?

I'm writing a small database-centric application in Java Swing that will be used internally in a small company. I haven't much experience with developing production-level applications. I don't use an ...
4
votes
4answers
112 views

What features are helpful when performing remote debugging / diagnostics?

Obviously, the easiest way to solve a bug is to be able to reproduce it in-house. However, sometimes that is not practical. For starters, users are often not very good at providing you with useful ...
4
votes
1answer
918 views

Best Creational Pattern for loggers in a multi-threaded system?

This is a follow up question on my past questions : Concurrency pattern of logger in multithreaded application As suggested by others, I am putting this question separately. As the learning from ...
4
votes
2answers
525 views

Log design approach

Logging was always a nightmare for me! Now I have to implement it again for a proxy system. In this proxy application, some systems ask proxy system to call some other services. What I have to log is ...
4
votes
2answers
2k views

Design pattern for logging changes in parent/child objects saved to database

I’ve got a 2 database tables in parent/child relationship as one-many. I’ve got three classes representing the data in these two tables: Parent Class { Public int ID {get; set;} .. other ...
3
votes
2answers
155 views

Common Industry Term For Negative Logging? [closed]

It is one thing to log something that happened in code, a process, or procedure. It is another thing to log something that didn't happen. For example, if your ETL system is supposed to receive a ...
3
votes
5answers
1k views

Is SQLite a sensible option for data logging?

I am trying to setup a small data-logging application under linux. The data arrives via serial port, and from there it should be pumped to logging and to graphical display. The logging functionality ...
3
votes
4answers
3k views

Which design pattern is more suitable for logging?

I should log some events in a program but as far as I know it would be better to keep the logging code outside the program because it is not about the real functionality of the program. So may you ...
3
votes
3answers
179 views

Filesystems that use logging: If you're writing the data in the log (on disk), and in the actual locations themselves (also on disk) then…?

Aren't you essentially writing the same data twice, to the disk? Doesn't this cause a slowdown of a factor of ~2x? What optimizations can be made to minimize the cost of having to write things twice? ...
3
votes
4answers
1k views

When should a database table use timestamps?

First a note, I thought maybe this question belonged in the database exchange, but I think it is more broadly related to a programming solution as a whole than to databases. Will move to database ...
3
votes
3answers
1k views

C++ log every function and parameter values

I want to log every function call and parameter value in my C++ app. Is there a generic approach for this task ? (3rd part library, VAR_ARGS etc.)
3
votes
1answer
100 views

Is console logging inappropriate for chatty applications?

12 Factor states that applications should log to the console, those console logs should should be unbuffered, and the logs should be redirected to someplace useful (file, database, whatever). But ...
3
votes
4answers
125 views

What is your approach to debugging a transient problem [closed]

I am working on a system that controls a label printer and occasionally the label printer will print the same label 2,3,...,10 times. The error is transient, occurring once per 3000-4000 (once a ...
3
votes
2answers
195 views

What percentage of code and runtime do you typically allow for testing?

When I write code, a certain amount of it is just for the purpose of logging, tracing, or otherwise "testing" what the program is doing. This not unit testing; this is not when it is running in ...
3
votes
3answers
184 views

how should I handle server error during ajax logout?

I need to write a handler for server error during user logout. What is a common practice? ajax.post({ url: '/auth/logout' }).done(function (response) { switch (response.statusCode) { ...
3
votes
1answer
70 views

Should I put logging in common shared libraries? [duplicate]

Should you add logging to common libraries that are used in many applications? For example, if I have a parser that's used in multiple apps, should I add logging inside the parser? My concern is that ...
3
votes
2answers
324 views

It is bad practice to hard couple logging interface/implementation with business model classes?

Should we avoid using logging in business model classes and try to move logging to service/controller classes? In for example java context, logging in model classes will hard couple the code with ...
3
votes
2answers
218 views

Verbose or concise logging [duplicate]

I was wondering how much data should be logged. I know this deeply depends on multiple factors. But it can still be hard to find the golden middle way. Lets say I have an application where people ...