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
279
votes
11 answers

Should a "static final Logger" be declared in UPPER-CASE?

In Java, static final variables are constants and the convention is that they should be in upper-case. However, I have seen that most people declare loggers in lower-case which comes up as a violation in PMD. e.g: private static final Logger logger…
dogbane
  • 266,786
  • 75
  • 396
  • 414
276
votes
5 answers

Logging levels - Logback - rule-of-thumb to assign log levels

I'm using logback in my current project. It offers six levels of logging: TRACE DEBUG INFO WARN ERROR OFF I'm looking for a rule of thumb to determine the log level for common activities. For instance, if a thread is locked, should the…
crimsonsky2005
  • 2,953
  • 4
  • 16
  • 14
268
votes
30 answers

Spring RestTemplate - how to enable full debugging/logging of requests/responses?

I have been using the Spring RestTemplate for a while and I consistently hit a wall when I'am trying to debug it's requests and responses. I'm basically looking to see the same things as I see when I use curl with the "verbose" option turned on. For…
Paul Sabou
  • 3,097
  • 3
  • 16
  • 9
266
votes
16 answers

Python logging: use milliseconds in time format

By default logging.Formatter('%(asctime)s') prints with the following format: 2011-06-09 10:54:40,638 where 638 is the millisecond. I need to change the comma to a dot: 2011-06-09 10:54:40.638 To format the time I can…
Jonathan Livni
  • 101,334
  • 104
  • 266
  • 359
257
votes
17 answers

What happened to console.log in IE8?

According to this post it was in the beta, but it's not in the release?
leeand00
  • 25,510
  • 39
  • 140
  • 297
254
votes
28 answers

Configure Node.js to log to a file instead of the console

Can I configure console.log so that the logs are written on a file instead of being printed in the console?
Randomblue
  • 112,777
  • 145
  • 353
  • 547
253
votes
10 answers

Logging uncaught exceptions in Python

How do you cause uncaught exceptions to output via the logging module rather than to stderr? I realize the best way to do this would be: try: raise Exception, 'Throwing a boring exception' except Exception, e: logging.exception(e) But my…
Jacob Marble
  • 28,555
  • 22
  • 67
  • 78
251
votes
9 answers

redirect COPY of stdout to log file from within bash script itself

I know how to redirect stdout to a file: exec > foo.log echo test this will put the 'test' into the foo.log file. Now I want to redirect the output into the log file AND keep it on stdout i.e. it can be done trivially from outside the…
Vitaly Kushner
  • 9,247
  • 8
  • 33
  • 41
249
votes
29 answers

Why doesn't logcat show anything in my Android?

Why doesn't logcat show anything in my Android (while developing apps with Eclipse)? It just doesn't print anything. It's empty.
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
244
votes
16 answers

In log4j, does checking isDebugEnabled before logging improve performance?

I am using Log4J in my application for logging. Previously I was using debug call like: Option 1: logger.debug("some debug text"); but some links suggest that it is better to check isDebugEnabled() first, like: Option 2: boolean debugEnabled =…
Silent Warrior
  • 5,069
  • 8
  • 41
  • 52
238
votes
7 answers

Logging within pytest tests

I would like to put some logging statements within test function to examine some state variables. I have the following code snippet: import pytest,os import logging logging.basicConfig(level=logging.DEBUG) mylogger =…
superselector
  • 3,007
  • 3
  • 19
  • 10
236
votes
8 answers

Python logging not outputting anything

In a python script I am writing, I am trying to log events using the logging module. I have the following code to configure my logger: ERROR_FORMAT = "%(levelname)s at %(asctime)s in %(funcName)s in %(filename) at line %(lineno)d:…
murgatroid99
  • 19,007
  • 10
  • 60
  • 95
233
votes
17 answers

Save the console.log in Chrome to a file

Does anyone know of a way to save the console.log output in Chrome to a file? Or how to copy the text out of the console? Say you are running a few hours of functional tests and you've got thousands of lines of console.log output in Chrome. How do…
eeejay
  • 5,394
  • 8
  • 29
  • 30
232
votes
14 answers

How to see query history in SQL Server Management Studio

Is the query history stored in some log files? If yes, can you tell me how to find their location? If not, can you give me any advice on how to see it?
mstaniloiu
  • 2,565
  • 4
  • 23
  • 18
232
votes
13 answers

Log exception with traceback in Python

How can I log my Python exceptions? try: do_something() except: # How can I log my exception here, complete with its traceback?
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080