Questions tagged [logging]

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.

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. Logs are essential to understand the activities of complex systems, particularly in the case of applications with little user interaction (such as server applications).

Examples:

Examples of physical systems which have logging subsystems include process control systems, and black box recorders installed in aircraft.

Many operating systems and complex computer programs include some form of logging subsystem. In the simplest case, log messages are written to a log file. Most operating systems and software frameworks also provide more sophisticated services for logging. One example is the syslog service (described in RFC 3164), which allows the filtering and recording of log messages to be performed by a separate dedicated subsystem, rather than placing the onus on each application to provide its own ad hoc logging system.

A server log is a log file (or several files) automatically created and maintained by a server of activity performed by it. A typical example is a web server log which maintains a history of page requests.

An audit log is a security-related log that provides documentary evidence of the sequence of activities that have affected at any time a specific operation, procedure, or event.

Standards

SysLog

Syslog is an informal standard for computer data logging that was developed in the 1980s by Eric Allman. It was created solely for Sendmail but proved so valuable that other applications began using it as well. It has since become the standard logging solution on Unix and Unix-like systems; there have also been a variety of implementations on other operating systems and it is commonly found in network devices such as routers.

The Internet Engineering Task Force has documented (but not formalized) the standard in RFC 5424.

Common Log Format

The Common Log Format (also known as the NCSA Common log format) and Extended Log Format are standardized text file formats used by web servers when generating log files. Because the formats are standardized, the files generated may be analyzed by a variety of web analysis programs.

Common Log Format entries take the form:

host ident authuser date request status bytes

Eg: 127.0.0.1 user-identifier frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326


References

Courtesy of SO tag logging

268 questions
74
votes
9 answers

What are some patterns and anti-patterns of application logging?

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 logs did not help at all identifying/isolating…
c_maker
  • 8,280
33
votes
4 answers

Logging into text file or database?

When should I use database for logging and when text files? I see that web servers and web frameworks (that your app uses internally) usually (always?) log requests and errors into text files by default. But I see that people who develop their app…
Nakilon
  • 499
15
votes
5 answers

Does the responsibility of logging method/function calls fall to the caller or the callee?

What are the pros and cons to each of the following ways of logging a function call? This code is written in Ruby but I feel the question applies to programming in general. Responsibility belongs to the callee class Foo def do_cool_stuff # Do…
15
votes
4 answers

Logging asynchronously - how should it be done?

In many of the services I work on there are a lot of logging being done. The services are WCF services (mostly) which use the .NET EventLogger class. I'm in the process of improving these services' performance, and I got to think that logging…
Mithir
  • 1,339
  • 3
  • 13
  • 23
9
votes
6 answers

How to insert logging information without making the code a mess

When working with some complex algorithms, I would like to have a way to keep track of some information for easy debugging. I just need to see sometimes how things are going, and have some easy way to extract data so I don't have to spend time…
Paul92
  • 2,581
5
votes
1 answer

Should I put logging in common shared libraries?

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 it couples all users to the logging…
5
votes
3 answers

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 active development, I've been clearing the…
Ben Brocka
  • 2,751
  • 1
  • 19
  • 30
3
votes
2 answers

Centralized and decentralized logging mechanisms

I've worked different kind of applications both having centralized and decentralized logging mechanisms. I feel centralized logging mechanism is good to see the proper flow of code and timing of executions while debugging problems. Most of the…
sarat
  • 1,121
  • 3
  • 11
  • 19
3
votes
2 answers

Logging Config - in code vs in config file

The built-in logging module of python 3.x allows for 3 ways to define a custom logger: INI-formatted file dict, json, yaml python (directly in code) In my opinion, it is easier to define a custom logger's config directly in the code, because this…
3
votes
3 answers

How can I make my logging more useful?

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 stuff. Example: Apr 9 21:49:58.648 [ DEBUG]…
ithisa
  • 237
  • 1
  • 7
2
votes
2 answers

Logging: safety vs performance. How do I choose?

While making an application I've come to the point where I want to add logging for the inevitable case when something goes wrong. Now this seems like a problem that should have been solved decades ago, and indeed - there's no shortage of logging…
Vilx-
  • 5,320
2
votes
1 answer

Loggers - Functional, non-functional or layered?

We use different loggers to break up and apply specific rules to different kinds of log data. We typically specify which logger to be used with something like this: var logger = Logger.GetLogger("MyLogger"); What is a recommended strategy on…
Dave New
  • 897
1
vote
2 answers

Rotated log file - what is it?

What does rotated log file means? There is any example? I used to see this term in logging libraries documentation but couldn't understand the meaning. Update: there is any different from a rolling log file?
1
vote
1 answer

Why do a lot of logging frameworks provide individual methods instead of a enum 'level'?

I see some of the more preferred logging frameworks like log4j, log4net etc all use 'trace, debug' etc methods. Why do they use these instead of methods that take something like a enum level?
1
vote
3 answers

Log within try-catch or after?

Should one log success of an operation within a try-catch-block, or after it? Example: try do x log('successful') catch log('fail') end or is this better: try do x catch log('fail') end log('successful') I would say that a…
zuiqo
  • 927
1
2