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
1 answer

python 3.6 *logging modul error* UnicodeEncodeError: 'charmap' codec can't encode characters

On Windows 10 the logging module send this error (using scrapy) # --- Logging error --- ... # UnicodeEncodeError: 'charmap' codec can't encode characters in position 175-176: character maps to I have read that I should add…
J. Does
  • 785
  • 3
  • 10
  • 23
18
votes
2 answers

Make HttpLoggingInterceptor do not log images

I'm trying to get rid of trash in logs, like *�$ʞx���J/ when i recieve an image So i tried to override HttpLoggingInterceptor intercept(), to detect is there a Content-Type => image/jpeg header in responce, but HttpLoggingInterceptor is final so…
whereismaxmax
  • 496
  • 5
  • 17
18
votes
1 answer

Python logger per function or per module

I am trying to start using logging in python and have read several blogs. One issue that is causing confusion for me is whether to create the logger per function or per module. In this Blog: Good logging practice in Python it is recommended to get a…
costrouc
  • 3,045
  • 2
  • 19
  • 23
18
votes
7 answers

get line number and filename for a log output

Is it possible to get the line number and file for each log output ? For example: var winston = require('winston'); winston.log('info', 'some message!'); // this is at line 4 of myfile.js should specify in log file that 'some message' came…
Lev
  • 13,856
  • 14
  • 52
  • 84
18
votes
1 answer

What is the default Celery log level if none is specified?

According to the Celery documentation, the -l/--loglevel command line option can be used for: -l, --loglevel Logging level, choose between DEBUG, INFO, WARNING, ERROR, CRITICAL, or FATAL. If this option is not used and therefore no log level is…
dukebody
  • 7,025
  • 3
  • 36
  • 61
18
votes
2 answers

How to view syslog in ubuntu?

Follow up from this question, LogBack Syslog not working java I use command below to view syslog in ubuntu 16.04 but get below result. Is it the correct way to view? user@xxx:~$ tail -f /var/log/syslog Jun 6 23:08:50 xxx systemd[1]: Starting…
Tony
  • 2,515
  • 14
  • 38
  • 71
18
votes
1 answer

INFO menuinst_win32:__init__(182): Menu: name: 'Anaconda${PY_VER} ${PLATFORM}'

Currently I get a lot of these INFO messages when I update packages: $ conda update --all --yes Fetching package metadata ................. Solving package specifications: . Package plan for installation in environment C:\anacondadir: The…
MSeifert
  • 145,886
  • 38
  • 333
  • 352
18
votes
1 answer

Python logger is not printing debug messages, although it is set correctly

I have the following code, where I just want to play around with the logging module using contextmanager. from contextlib import contextmanager import logging @contextmanager def log_level(level, name): logger = logging.getLogger(name) …
Arthur
  • 553
  • 1
  • 4
  • 10
18
votes
1 answer

What is the different between the get logger functions from celery.utils.log and logging?

I have been trying to figure out the difference between the python logger and the celery logger, specifically the difference between the commands below, but cannot find a good answer. I am using celery v3, with django 1.10. from celery.utils.log…
jmerkow
  • 1,811
  • 3
  • 20
  • 35
18
votes
4 answers

Show log messages on screen for Android application

Is it possible to display the log messages (which I print using android.util.Log) on screen in an Android application? Is there any other better method to just output lines on the screen? Something like System.out.println?
n1kh1lp
  • 14,247
  • 6
  • 29
  • 28
18
votes
5 answers

TSQL logging inside transaction

I'm trying to write to a log file inside a transaction so that the log survives even if the transaction is rolled back. --start code begin tran insert [something] into dbo.logtable [[main code here]] rollback commit -- end code You could say just do…
Arvid
  • 181
  • 1
  • 1
  • 3
18
votes
3 answers

Electron app - logging to file in production

I want to get logs if something wrong happens to my electron app when in production mode i.e after giving .exe file to a user wrt windows platform. How to go about it, how can i basically write my errors to a file which will be in cyclic in nature.
Anuj Nautiyal
  • 599
  • 1
  • 4
  • 11
18
votes
5 answers

How to override Gunicorn's logging config to use a custom formatter

I would like gunicorn.error to use the following key-value based log format instead of the default defined in gunicorn/glogging.py: 'format': 'timestamp=%(asctime)s pid=%(process)d loglevel=%(levelname)s msg=%(message)s'` In my gunicorn config…
Python Novice
  • 1,980
  • 5
  • 26
  • 33
18
votes
3 answers

How to override log4j.properties during testing?

I'm trying to log all DEBUG messages to console during testing in maven. For this purpose I created a file src/test/resources/log4j.properties, which is going to override the configuration I already have in src/main/resources/log4j.properties.…
yegor256
  • 102,010
  • 123
  • 446
  • 597
18
votes
1 answer

Adding tracelistener to web.config

I want to use below code with a website. Which config sections I should add to web.config to log the output into a file or windows eventlog ? using System.Diagnostics; // Singleton in real code Class Logger { // In constructor: Trace.AutoFlush =…
Xaqron
  • 29,931
  • 42
  • 140
  • 205