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

python log formatter that shows all kwargs in extra

I hope to add the following log points to my application and display the full contents of extra on console, e.g., logger.info('Status', extra={'foo':data}) logger.info('Status', extra={'bar':data}) logger.info('Status', extra={'foo':data,…
CJLam
  • 801
  • 3
  • 10
  • 15
18
votes
2 answers

How to extend the logging.Logger Class?

I would like to start with a basic logging class that inherits from Python's logging.Logger class. However, I am not sure about how I should be constructing my class so that I can establish the basics needed for customising the inherited…
mbilyanov
  • 2,315
  • 4
  • 29
  • 49
18
votes
3 answers

Capturing HTML generated from ASP.NET

How do I best capture the HTML (in my instance, for logging) rendered by an aspx-page? I dont want to have to write back to the page using Response.Write, since it messes up my site layout. Using the Response.OutputStream or Response.Output's stream…
lastas
  • 227
  • 3
  • 8
18
votes
5 answers

How to configure gradle to output total number of tests executed?

While tests are running, the number of tests run so far is ephemerally displayed, but how can I print the total number of tests that were run to the console after all tests have run? Configuring testLogging doesn't help. I can make gradle output a…
Bohemian
  • 412,405
  • 93
  • 575
  • 722
18
votes
2 answers

Logback: SizeAndTimeBasedRollingPolicy not honoring totalSizeCap

I'm trying to manage my logging in a way in which my oldest archived logfiles are deleted once they've either reached the total cumulative size limit or reached their maximum history limit. When using the SizeAndTimeBasedRollingPolicyin Logback…
Brady Goldman
  • 347
  • 1
  • 4
  • 11
18
votes
1 answer

JAX-RS 2 print JSON request

I'd like to be able to print JAX-RS 2 JSON payload from request, regardless of actual implementation on my application server. I've tried suggested solutions on SO but all include binaries from actual implementation (like Jersey and similar), and…
D00de
  • 880
  • 3
  • 7
  • 26
18
votes
5 answers

Where/what level should logging code go?

I'm wondering where logging code should go. For example, should my repository log it's own errors? Or should I log all errors from the UI/controller? Are there any general deisgn principles about this, or does anyone have link to a good article or…
fearofawhackplanet
  • 52,166
  • 53
  • 160
  • 253
18
votes
3 answers

How the cdc retention value can be changed for the cleanup job?

I'm implementing a logging feature on a asp.net mvc2 application, that uses SqlServer2008 as a database and Entity Framework as a data model. I enabled CDC feature of SqlServer and it's logging changes well, but I just noticed that some of the old…
Eedoh
  • 5,818
  • 9
  • 38
  • 62
18
votes
0 answers

Is there a way to enable console.log while running mocha tests?

I'm using mocha along with yeiwd and chai to test a javascript web application. I'd like to see console logs from within the application to help debug some tests. When I run the tests from the comand line with npm test I don't see any console.log()…
barry
  • 4,037
  • 6
  • 41
  • 68
18
votes
4 answers

Logging from Java app to ELK without need for parsing logs

I want to send logs from a Java app to ElasticSearch, and the conventional approach seems to be to set up Logstash on the server running the app, and have logstash parse the log files (with regex...!) and load them into ElasticSearch. Is there a…
Rob
  • 5,512
  • 10
  • 41
  • 45
18
votes
6 answers

PHP: How to read a file live that is constantly being written to

I want to read a log file that is constantly being written to. It resides on the same server as the application. The catch is the file gets written to every few seconds, and I basically want to tail the file on the application in real-time. Is this…
HyderA
  • 20,651
  • 42
  • 112
  • 180
18
votes
2 answers

Logback - Print out method name that called the log method

In my example, I have the following code: package com.example.somepackage; public class Example { public static void main(String[] args) { org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Example.class); …
randers
  • 5,031
  • 5
  • 37
  • 64
18
votes
4 answers

ClassCastException: org.slf4j.impl.Log4jLoggerAdapter cannot be cast to ch.qos.logback.classic.Logger

I was following this answer in order to add a appender on runtime. Even though that works for the original poster, I get this exception in line Logger logger = (Logger) LoggerFactory.getLogger("abc.xyz");: java.lang.ClassCastException:…
Erando
  • 811
  • 3
  • 13
  • 27
18
votes
3 answers

uWSGI / Flask / Python logs stop after some time

I have a uWSGI / Flask setup using python loggers. Though logs only from some workers get to the logs and after some time even those cease to show up at all. My hypothesis is that when uWSGI restarts (clones) workers, logging somehow gets broken.…
Ernests Karlsons
  • 2,220
  • 5
  • 25
  • 37
18
votes
6 answers

How to suppress parquet log messages in Spark?

How to stop such messages from coming on my spark-shell console. 5 May, 2015 5:14:30 PM INFO: parquet.hadoop.InternalParquetRecordReader: at row 0. reading next block 5 May, 2015 5:14:30 PM INFO: parquet.hadoop.InternalParquetRecordReader:…
user568109
  • 47,225
  • 17
  • 99
  • 123