Questions tagged [logging]

Computer data logging is the process of recording events in a computer program or computer system, 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. Be sure to include appropriate software or hardware tags in addition to this tag.

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. 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

41059 questions
226
votes
8 answers

Have nginx access_log and error_log log to STDOUT and STDERR of master process

Is there a way to have the master process log to STDOUT STDERR instead of to a file? It seems that you can only pass a filepath to the access_log directive: access_log /var/log/nginx/access.log And the same goes for error_log: error_log…
quinn
  • 5,508
  • 10
  • 34
  • 54
223
votes
20 answers

How can I disable logging while running unit tests in Python Django?

I am using a simple unit test based test runner to test my Django application. My application itself is configured to use a basic logger in settings.py using: logging.basicConfig(level=logging.DEBUG) And in my application code using: logger =…
shreddd
  • 10,975
  • 9
  • 33
  • 34
222
votes
10 answers

log4j logging hierarchy order

What is the hierarchy of log4j logging? DEBUG INFO WARN ERROR FATAL Which one provides the highest logging which would be helpful to troubleshoot issues? Can any one provide the order or hierarchy in which logging take place from highest to…
Mike
  • 7,606
  • 25
  • 65
  • 82
222
votes
6 answers

Where is a complete example of logging.config.dictConfig?

How do I use dictConfig? How should I specify its input config dictionary?
David Wolever
  • 148,955
  • 89
  • 346
  • 502
222
votes
9 answers

How to see log files in MySQL?

I've read that Mysql server creates a log file where it keeps a record of all activities - like when and what queries execute. Can anybody tell me where it exists in my system? How can I read it? Basically, I need to back up the database with…
Arjun
  • 3,491
  • 4
  • 25
  • 47
222
votes
7 answers

What is the command to truncate a SQL Server log file?

I need to empty an LDF file before sending to a colleague. How do I force SQL Server to truncate the log?
Aidan Ryan
  • 11,389
  • 13
  • 54
  • 86
213
votes
6 answers

How to log source file name and line number in Python

Is it possible to decorate/extend the python standard logging system, so that when a logging method is invoked it also logs the file and the line number where it was invoked or maybe the method that invoked it?
digy
  • 2,663
  • 3
  • 19
  • 14
212
votes
7 answers

Does IE9 support console.log, and is it a real function?

In which circumstances is window.console.log defined in Internet Explorer 9? Even when window.console.log is defined, window.console.log.apply and window.console.log.call are undefined. Why is this? [Related question for IE8: What happened to…
mloughran
  • 11,415
  • 7
  • 28
  • 22
212
votes
22 answers

How to disable logging on the standard error stream?

How to disable logging on the standard error stream in Python? This does not work: import logging logger = logging.getLogger() logger.removeHandler(sys.stderr) logger.warning('foobar') # emits 'foobar' on sys.stderr
sorin
  • 161,544
  • 178
  • 535
  • 806
211
votes
5 answers

Write to Windows Application Event Log without event source registration

Is there a way to write to this event log: Or at least, some other Windows default log, where I don't have to register an event source?
Jerther
  • 5,558
  • 8
  • 40
  • 59
211
votes
5 answers

How to configure slf4j-simple

api 1.7 and slf4j-simple as implementation. I just can't find how to configure the logging level with this combination. Can anyone help out?
Gelin Luo
  • 14,035
  • 27
  • 86
  • 139
209
votes
14 answers

How to redirect docker container logs to a single file?

I want to redirect all the logs of my docker container to single log file to analyse them. I tried docker logs container > /tmp/stdout.log 2>/tmp/stderr.log but this gives log in two different file. I already tried docker logs container >…
KETAN PATIL
  • 2,276
  • 2
  • 13
  • 18
208
votes
10 answers

Is there a way to dump a stack trace without throwing an exception in java?

I am thinking of creating a debug tool for my Java application. I am wondering if it is possible to get a stack trace, just like Exception.printStackTrace() but without actually throwing an exception? My goal is to, in any given method, dump a stack…
corgrath
  • 11,673
  • 15
  • 68
  • 99
208
votes
6 answers

How to track down log4net problems

I use log4net all the time, but one thing I've never figured out is how to tell what's going on on the inside. For example, I've got a console appender and a database appender in my project. I made a few changes to the database and the code, and now…
John M Gant
  • 18,970
  • 18
  • 64
  • 82
208
votes
16 answers

MongoDB logging all queries

The question is as basic as it is simple... How do you log all queries in a "tail"able log file in mongodb? I have tried: setting the profiling level setting the slow ms parameter starting mongod with the -vv option The…
João Rocha da Silva
  • 4,259
  • 4
  • 26
  • 35