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
4 answers

How to make a Logger for System.out

I am wondering how to get org.slf4j.Logger for System.out. I know this is not good, but I need it for testing purposes. Thank you so much.
Anton K.
  • 933
  • 3
  • 9
  • 22
18
votes
4 answers

How to log repeated warnings only once

There is a pattern that happens every now and then. I have a method called many times, and it contains this snippet: Foo foo = getConfiguredFoo(); if (foo == null) { logger.warn("Foo not configured"); foo = getDefaultFoo(); } Then my log file…
Adam Schmideg
  • 10,590
  • 10
  • 53
  • 83
18
votes
11 answers

SharePoint 2007 Log Viewer

SharePoint 2007 (WSS or MOSS) logs are not easy to read even on a large screen, has anyone come across a log viewer that is able to: Display SharePoint logs live and historical Filter the events by various parameters Cope with SharePoint's log…
Richard Slater
  • 6,313
  • 4
  • 53
  • 81
18
votes
2 answers

C++ macro to log every line of code

During one of my recent discussions with my manager, he mentioned that one of his former clients used a C++ macro to log info about every line of code. All they had to do was enable an environment variable before starting the run. (Of course the…
Karthick S
  • 3,204
  • 6
  • 36
  • 52
18
votes
4 answers

logrotate compress files after the postrotate script

I have an application generating a really heavy big log file every days (~800MB a day), thus I need to compress them but since the compression takes time, I want that logrotate compress the file after reloading/sending HUP signal to the…
Thomas BDX
  • 2,632
  • 2
  • 27
  • 31
18
votes
1 answer

What is the difference among Cloud Logging vs Cloud Monitoring vs Stackdriver?

I am exploring logging, monitoring and alerting options on Google Cloud. Where I found Cloud Logging, Monitoring and Stackdriver as few options. Theoretically, these services looks similar. Can anyone explain what is the actual difference between…
18
votes
5 answers

How do I pipe the Java console output to a file?

I found a bug in an application that completely freezes the JVM. The produced stacktrace would provide valuable information for the developers and I would like to retrieve it from the Java console. When the JVM crashes, the console is frozen and I…
Cedric Meury
  • 953
  • 1
  • 7
  • 19
18
votes
7 answers

Should unit tests use logging?

There seems to be two trends on this topic: Some answers (such as this one) suggest unit tests should not log anything. Some questions and answers (such as this one) suggest different logging techniques and formats used in unit tests. Should unit…
Laurent Pireyn
  • 6,735
  • 1
  • 29
  • 39
18
votes
5 answers

How to shorten thread name in logback logs?

You can shorten the name of the logger using %logger{x} syntax where x controls shortening procedure. Is there any way to shorten the name of the thread the same way?
Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156
18
votes
2 answers

Proper way to shutdown a logger instance in log4Net

I have a class to whose every instance i create a new logger and attache a buffer appender and a flie appender to it. Everything is being done runtime and no information is picked from the config file. Now to release resources at the class's custom…
Basit Anwer
  • 6,742
  • 7
  • 45
  • 88
18
votes
5 answers

Ideolog (PyCharm): how to configure log format for standard logging library

I am using standard Python logging library (import logging) and install Ideolog plugin. But it doesn't support format of standard logging library (and PyCharm asks to configure it). I have tried some regex, but they don't fit. How should I configure…
Abionics
  • 197
  • 1
  • 2
  • 8
18
votes
2 answers

How to use the logging module in Python with gunicorn

I have a flask-based app. When I run it locally, I run it from the command line, but when I deploy it, I start it with gunicorn with multiple workers. I want to use the logging module to log to a file. The docs I've found for this are…
user2428107
  • 3,003
  • 3
  • 17
  • 19
18
votes
6 answers

How to use logger to print a list in just one line in Python

I want to print a list using logging in only one line in Python 3.6. Currently my code looks like this. logger = logging.getLogger() logger.setLevel(log_level) ch = logging.StreamHandler(sys.stdout) ch.setLevel(log_level) formatter =…
Jekyll SONG
  • 479
  • 3
  • 6
  • 18
18
votes
5 answers

Spring boot embedded tomcat logs

i'm using spring boot embedded tomcat with spring boot 1.5.9 , im also using Log4j2. recently i exerience problems during load, so i want to understand better the tomcat logs [Not the access Logs] , i tried (in application.properties) :…
Robocide
  • 6,353
  • 4
  • 37
  • 41
18
votes
3 answers

Suppress Logger when testing

I wonder how to disable logging in Elixir when testing. In my current code I test for logger messages, so I don't want to disable it completely, but hide the messages until any test stop passing. I'm using mix and ExUnit to manage and test my…
Jump3r
  • 1,028
  • 13
  • 29