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

42
votes
9answers
3k 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
3k 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. ...
29
votes
3answers
11k 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 ...
20
votes
11answers
3k 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 ...
15
votes
6answers
31k 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 ...
15
votes
8answers
1k views

Recommendations for .NET Logging components [closed]

I'm looking for a really good and light .NET logging component. I've used Enterprise Library and do like it but it's a bit heavy if you don't use other components in the collection. I've recently ...
14
votes
4answers
3k 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 ...
14
votes
2answers
570 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 ...
12
votes
2answers
887 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
1k 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
635 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 ...
8
votes
2answers
355 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 ...
7
votes
11answers
674 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
400 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
7answers
7k 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
5answers
269 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 ...
6
votes
4answers
302 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
277 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 ...
6
votes
3answers
236 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 ...
5
votes
13answers
705 views

Logging, do you do it?

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 ...
5
votes
3answers
1k 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 ...
5
votes
4answers
302 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
2answers
202 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
331 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
5answers
917 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
5answers
269 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
144 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
2answers
148 views

Common Industry Term For Negative Logging?

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 ...
4
votes
4answers
297 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
4answers
103 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
2answers
346 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
1answer
703 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
463 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 ...
3
votes
3answers
177 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
3answers
635 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
4answers
264 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
601 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
2answers
190 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
76 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
2answers
206 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
152 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 ...
3
votes
1answer
67 views

An extensible logging architecture for Android?

The end goal is to have a variety of data sets that can all be graphically plotted against eachother. All data should correspond to a date, so that when plotted against each other, they show the ...
3
votes
2answers
1k 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 ...
2
votes
3answers
152 views

How can I make my logging more useful? [duplicate]

I tend to find that after I build an application, the logs emitted by it become near useless and completely unparseable, and has the problem of being really verbose, while not outputting important ...
2
votes
3answers
118 views

Forcing logger/appender to output line logged at lower than its current level?

Consider the following scenario: I am writing a Dispatcher Servlet that delegates processing to various handlers depending on the request URL; the handler objects having previously registered ...
2
votes
1answer
106 views

Logging in a latency sensitive system

Requirements: My application is latency sensitive. Millisecond level responsiveness matters. Not all the time, but when it acts, it needs to be fast. My application needs to log information about ...
2
votes
2answers
222 views

When is it okay to log filename/line information for errors?

We have a closed-source commercial C++ application. Some of our logged error messages are in plain English like "ERROR: could not read file 'foo'". While others use a macro to print filename/line ...
2
votes
3answers
82 views

Allowing the user to specify the location of a logfile

I'm working on an application, and adding logging, but now I'm stuck. I want to allow (not force!) the user to set the location of the logfile. Basically, my problem is: logger initialization ...