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
203
votes
15 answers

How to Get the Query Executed in Laravel 5? DB::getQueryLog() Returning Empty Array

I'm trying to view the log for a query, but DB::getQueryLog() is just returning an empty array: $user = User::find(5); print_r(DB::getQueryLog()); Result Array ( ) How can I view the log for this query?
Arsen
  • 3,541
  • 4
  • 14
  • 7
200
votes
12 answers

Should I take ILogger, ILogger, ILoggerFactory or ILoggerProvider for a library?

This may be somewhat related to Pass ILogger or ILoggerFactory to constructors in AspNet Core?, however this is specifically about Library Design, not about how the actual application that uses those libraries implement its logging. I am writing a…
Michael Stum
  • 177,530
  • 117
  • 400
  • 535
199
votes
4 answers

Configuring Log4j Loggers Programmatically

I am trying to use SLF4J (with log4j binding) for the first time. I would like to configure 3 different named Loggers that can be returned by a LoggerFactory which will log different levels and push the messages to different appenders: Logger 1…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
198
votes
10 answers

Get Output From the logging Module in IPython Notebook

When I running the following inside IPython Notebook I don't see any output: import logging logging.basicConfig(level=logging.DEBUG) logging.debug("test") Anyone know how to make it so I can see the "test" message inside the notebook?
Kyle Brandt
  • 26,938
  • 37
  • 124
  • 165
197
votes
6 answers

__FILE__, __LINE__, and __FUNCTION__ usage in C++

Presuming that your C++ compiler supports them, is there any particular reason not to use __FILE__, __LINE__ and __FUNCTION__ for logging and debugging purposes? I'm primarily concerned with giving the user misleading data—for example, reporting the…
Runcible
  • 7,006
  • 12
  • 42
  • 62
195
votes
14 answers

Python Logging - Disable logging from imported modules

I'm using the Python logging module, and would like to disable log messages printed by the third party modules that I import. For example, I'm using something like the following: logger = logging.getLogger() logger.setLevel(level=logging.DEBUG) fh…
blindsnowmobile
  • 3,868
  • 6
  • 32
  • 47
194
votes
7 answers

How to use MDC with thread pools?

In our software we extensively use MDC to track things like session IDs and user names for web requests. This works fine while running in the original thread. However, there's a lot of things that need to be processed in the background. For that we…
Lóránt Pintér
  • 10,152
  • 14
  • 47
  • 53
189
votes
12 answers

Save Screen (program) output to a file

I need to save the whole output of Screen to a file to check later all the content. The reason is that I'm dumping a flash memory through a serial port, using Screen to interface with it. I would like to save it to a file to check memory…
Edoardoo
  • 2,739
  • 4
  • 18
  • 27
188
votes
17 answers

What is the best way to dump entire objects to a log in C#?

So for viewing a current object's state at runtime, I really like what the Visual Studio Immediate window gives me. Just doing a simple ? objectname Will give me a nicely formatted 'dump' of the object. Is there an easy way to do this in code,…
Dan Esparza
  • 28,047
  • 29
  • 99
  • 127
186
votes
6 answers

Ruby on Rails production log rotation

What is the best way to enable log rotation on a Ruby on Rails production app? Is it by using logrotate on the hosting server or is there a set of options to use when initializing logger from the app?
cnikolaou
  • 3,782
  • 4
  • 25
  • 32
184
votes
2 answers

Is it worth to use slf4j with log4j2

I am not able to decide whether to use slf4j or not with log4j2. Based on online posts, does not look like it will have any performance hit but is it really required. Also these points rule in favor of log4j2: SLF4J forces your application to log…
Andy897
  • 6,915
  • 11
  • 51
  • 86
184
votes
10 answers

Node.js Logging

Is there any library which will help me to handle logging in my Node.Js application? All I want to do is, I want to write all logs into a File and also I need an options like rolling out the file after certain size or date. I have incorporated…
syv
  • 3,528
  • 7
  • 35
  • 50
183
votes
17 answers

How to get Android crash logs?

I have an app that is not in the market place (signed with a debug certificate), but would like to get crash log data, whenever my application crashes. Where can I find a log of why my app crashed?
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556
181
votes
7 answers

Tail docker logs to see recent records, not all

If you use the Coreutils tail command in Linux, you have a -f option that lets you follow a log file from the log's current position (it does not go to the very beginning of the file and display everything). Is this functionality available in docker…
svenwinkle
  • 1,927
  • 2
  • 10
  • 8
180
votes
14 answers

Logging in Scala

What is a good way to do logging in a Scala application? Something that is consistent with the language philosophy, does not clutter the code, and is low-maintenance and unobtrusive. Here's a basic requirement list: simple does not clutter the…
George
  • 3,433
  • 4
  • 27
  • 25