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

Enabling MySQL general query log with JDBC

Is there a way to enable MySQL general query logging through JDBC? The closest thing I have found through my search is the ability to log slow queries through JDBC…
alfredough
  • 385
  • 2
  • 4
  • 10
18
votes
12 answers

How to log user_name in Rails?

I use Devise in Rails 3. I want to see name of current_user in production.log. I would like to configure rails like this: config.log_tags = [:user_name]
boblin
  • 3,541
  • 4
  • 25
  • 29
18
votes
2 answers

Logging formatters in django

From the Django documentation, here is an example format for logging: 'formatters': { 'verbose': { 'format': '%(levelname)s %(asctime)s %(module)s: %(message)s' } } This prints something like: ERROR 2012-05-22 14:33:07,261 views…
David542
  • 104,438
  • 178
  • 489
  • 842
18
votes
3 answers

log debug enabled check in java

What is the point of having the if statement here? The severity level can be changed in log4j.xml config file. If the severity level is debug, it'll log the debug message, else it will not. What is the significance of the if statement below? if…
user2434
  • 6,339
  • 18
  • 63
  • 87
18
votes
2 answers

django logging - django.request logger and extra context

Am on django 1.3., python 2.6 In the django docs here https://docs.djangoproject.com/en/1.3/topics/logging/#django-request it says that messages have the following extra context: status and request. How do you get these to show up in the debug file?…
w--
  • 6,427
  • 12
  • 54
  • 92
17
votes
3 answers

where are my log files in heroku?

I have logging configured going to console and a log file. In heroku world, does it even make sense to log to a file? Is there any way I can retrive the log file?
Bobo
  • 8,777
  • 18
  • 66
  • 85
17
votes
3 answers

relation between log4j and apache.commons.logging

Could anybody please tell me what's the relation between log4j and apache.commons.logging ? which one is more popular and better ? I have imported an existing Application in which they have imported import org.apache.commons.logging.LogFactory; and…
Pawan
  • 31,545
  • 102
  • 256
  • 434
17
votes
2 answers

Oracle SQL Query logging

I'm using Oracle 11g Standard Edition. I would like to log all SQL queries, that are being executed by users, into a table. How can this be done?
JMW
  • 7,151
  • 9
  • 30
  • 37
17
votes
2 answers

Rails - Completed time for a request significantly higher than View and DB times

I have a controller that returns JSON or XML from a fairly complex relational query with some controller logic as well. I've tuned on the DB side by refining my query and making sure my indexes are correct for my query. In my log I see items like…
Nick
  • 8,483
  • 10
  • 46
  • 65
17
votes
4 answers

How do I detect if I'm running in the console

Is there a simple way to have a code library automatically detect if it's being called from a console application or a windows application? I'd like my library not to report to the Windows Event log if it's being called from a console window, but…
BenAlabaster
  • 39,070
  • 21
  • 110
  • 151
17
votes
6 answers

Disable logging per method/function?

I'm new to Python logging and I can easily see how it is preferrable to the home-brew solution I have come up with. One question I can't seem to find an answer to: how do I squelch logging messages on a per-method/function basis? My hypothetical…
JS.
  • 14,781
  • 13
  • 63
  • 75
17
votes
2 answers

Logging current function name

I have a few custom logfunctions that are extensions of cat. A basic example is something like this: catt<-function(..., file = "", sep = " ", fill = FALSE, labels = NULL, append = FALSE) { cat(..., format(Sys.time(), "(%Y-%m-%d %H:%M:%S)"),…
Nick Sabbe
  • 11,684
  • 1
  • 43
  • 57
17
votes
3 answers

Is a logger per class or is a set of loggers that are accessed by the entire application perferred?

I have a project in Java, and I create seven loggers that are accessed by a facade from every point of the program. But in the internet, I see a lot of examples witha a logger in each class. What is the most recommended way to do logging?
Renato Dinhani
  • 35,057
  • 55
  • 139
  • 199
17
votes
6 answers

Logging library for C

I am looking for a productive and simple logging library for C, which can output the log to a file. Displaying messages in the log I want to make like this: date-time tag message It would be nice to control the level of detail of messages and…
trafalgarx
  • 702
  • 2
  • 10
  • 13
17
votes
4 answers

How to rotate the tomcat localhost log?

I am using tomcat 6x in a Linux system. It prints a localhost log file like localhost.2011-06-07, localhost.2011-06-08 on a daily basis. I want to rotate the localhost when it reaches 1MB. I can rotate log files in log4j for my web apps. But this…
Tito
  • 8,894
  • 12
  • 52
  • 86