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
18
votes
2 answers

log4net configuration - failed to find section

This is my error message: log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in the application's .config file. Check your .config file for the and elements. The configuration section should look…
MikroDel
  • 6,705
  • 7
  • 39
  • 74
18
votes
1 answer

In a python logging is there a formatter to truncate the string?

Python logging formats strings with a syntax I don't see elsewhere in python, like 'format': '%(name)s' Is there any way to truncate an error message using the formatter, or do I need to override the LogRecord class for that? This truncates parts…
hobs
  • 18,473
  • 10
  • 83
  • 106
18
votes
1 answer

Logging in Rails, is there any performance hit?

Rails comes bundled with Ruby's logger class in the standard library. The available log levels are: :debug, :info, :warn, :error, and :fatal. I was wondering if I add extensive logging in my Rails application with log level set to :debug for…
CuriousMind
  • 33,537
  • 28
  • 98
  • 137
18
votes
6 answers

Merging multiple log files by date including multilines

I have several logs containing lines all starting with a timestamp, so that the following works as expected to merge them: cat myLog1.txt myLog2.txt | sort -n > combined.txt Problem is, that myLog2.txt can also contain lines without a timestamp…
Marco Behler
  • 3,627
  • 2
  • 17
  • 19
18
votes
4 answers

Traditional logging vs AOP logging

I'm starting this new project and we are thrashing out our logging/debugging approach and I wanted to put the question to the rest of you on SO, given private final static Logger logger = LoggerFactory.getLogger(getClass()); ... public void…
non sequitor
  • 18,296
  • 9
  • 45
  • 64
18
votes
7 answers

Java: How to log raw JSON as JSON and avoid escaping during logging with logback / slf4j

I'm using SLF4J with Logback in a JAX-RS application... I want to log to JSON in such a way that my message is not encoded again but printed raw into the logfile: At the moment it looks like…
kei1aeh5quahQu4U
  • 143
  • 1
  • 9
  • 23
18
votes
3 answers

Python logging multiple files using the same logger

This is my scenario: I want to log my_module's activity. This needs to be done, depending on the method executed (let's say, INPUT and OUTPUT), to two different files. So I have two Handlers, each one point to a different file (my_in_.log &…
Alberto Megía
  • 2,225
  • 3
  • 23
  • 33
18
votes
2 answers

Using Logback but Log4j started displaying WARN no Appenders

I am using logback for my logging and it has been working however; the other day I started getting a warning log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectResourceBundle). log4j:WARN Please initialize the log4j…
Chris Watts
  • 2,284
  • 4
  • 23
  • 28
18
votes
2 answers

Git log --stat summary of branch

I would like to show how many changes (insertions+deletions) I made on a feature branch. Is there a way to get a summary of the git log --stat output for the changes between 2 commits (branch root / tip). Thanks.
opatut
  • 6,708
  • 5
  • 32
  • 37
18
votes
3 answers

Maintaining Logging and/or stdout/stderr in Python Daemon

Every recipe that I've found for creating a daemon process in Python involves forking twice (for Unix) and then closing all open file descriptors. (See http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ for an example). This…
dave mankoff
  • 17,379
  • 7
  • 50
  • 64
18
votes
6 answers

Custom Logger class and correct line number/function name in log

I'd like to wrap Python logger in a custom class to embed some application-specific functionality and hide setup details from developers (setting file output, logging level, etc). To do this, I created a class with the following…
Alan Evangelista
  • 2,888
  • 6
  • 35
  • 45
18
votes
10 answers

How does one make logging color in Django/Google App Engine?

If one iswriting a Django/ Google App Engine application and would like to have logs that are conveniently conspicuous based on color (i.e. errors in red), how does one set that up? I've copied the helpful solution from this question, but I'm not…
Brian M. Hunt
  • 81,008
  • 74
  • 230
  • 343
18
votes
1 answer

Getting current line of code in Ruby

Crazy thought today. Is there any way to grab the line number that code has been executed on? Logger.info "I was run on line #{get_line_number}"
OVERTONE
  • 11,797
  • 20
  • 71
  • 87
18
votes
4 answers

What does LSN mean in SQL Server?

What is the meaning of Log Sequence Number? I know that it is of type binary and 10bytes long and it corresponds to the time the transaction happen in DB. But is this a high precision date-time value that is stored in some efficient binary format or…
Faiz
  • 5,331
  • 10
  • 45
  • 57
18
votes
3 answers

Find line number of function call from sourcing file

I'm trying to find a way to find out what file and line number a function was called from. The function is in a library file which is being sourced by my script. file1: $source file2 $warn_me "Error: You didn't do something" file2: $function…
spizzak
  • 1,087
  • 1
  • 11
  • 17