Questions tagged [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.

Filter by
Sorted by
Tagged with
90
votes
6answers
85k views

Why does the TRACE level exist, and when should I use it rather than DEBUG?

In Log4J, Slf4J and a couple other logging frameworks in Java, you have two "developper" level for logging: DEBUG TRACE I understand what DEBUG does, because the explanation is clear: The DEBUG ...
3
votes
1answer
264 views

Logging an application in Python

Recently I have worked in a small standalone Python console application and have inherited some code from another team. Although some of us have written small Python scripts in the past, none of us ...
3
votes
2answers
129 views

Do I use Repository or Service Object to Perform Logging?

I'm working in Java Spring, and I have typical service and repository layers. The repository grabs a JSON; passes it along to the service; service maps the repository response to a DTO. I also need ...
0
votes
0answers
29 views

log centralization and central aggregation system design

I'm thinking of how would I go about creating my own logging centralization and centralized aggregation system. Imagined system has 10 - 100 nodes. Each node runs a LAMP(Linux, Apache, MySql, PHP) ...
1
vote
0answers
53 views

Database vs Logs - Persistence approach evaluation

I have a node js app, in which I need to perform background jobs. My plan is to use a data structure which will contain all the jobs needs done. My design also suggests that this data structure needs ...
19
votes
6answers
11k views

Try/Catch/Log/Rethrow - Is Anti Pattern?

I can see several post where importance of handling exception at central location or at process boundary been emphasized as a good practice rather than littering every code block around try/catch. I ...
1
vote
0answers
33 views

Log data anonymization with ELK

I'm considering using the ELK stack for logging within our company. To comply with our data retention policy, we would like to anonymize data after one year so it cannot be traced back to an ...
114
votes
3answers
42k views

Benefits of Structured Logging vs basic logging

We're building a new app and I'd like to include structured logging. My ideal setup would be something like Serilog for our C# code, and Bunyan for our JS. These would feed into fluentd and then could ...
2
votes
1answer
81 views

How to Avoid Copy Pasting Repetitive Log Calls

Currently working on a Go project of about 10k lines of code. Within the project, there's a logging library that requires a couple steps of initialization in order to actually write to the log ...
2
votes
3answers
195 views

What is the proper logging level for tests?

I raised an issue at my employer concerning our gigantic heaps of testing logs. I raised the issue because I was spending well over a minute to find the relevant logs and stack-trace. I stated we ...
11
votes
2answers
22k views

Is Logger.getLogger(MyClass.class) the best way to initialise log4j loggers?

This Mkyong tutorial suggests intialising loggers this way: @Controller public class WelcomeController { private static final Logger logger = Logger.getLogger(WelcomeController.class); // ...
0
votes
1answer
136 views

I'm writing an application that needs to log error/ exception messages but should still continue execution if it not a fatal error

I'm writing an application that needs to log error/ exception messages but should still continue execution if the error is not a fatal error. I was thinking of making a method that returns a Task but ...
3
votes
2answers
221 views

Logging Config - in code vs in config file

The built-in logging module of python 3.x allows for 3 ways to define a custom logger: INI-formatted file dict, json, yaml python (directly in code) In my opinion, it is easier to define a custom ...
0
votes
4answers
486 views

Is it worth logging HTTP requests when they enter an API server?

I'm designing an API and have reached the topic of logging. I'm going to store my logs in Elasticsearch. I'm certainly going to do some logging at the time the HTTP response is sent back to the ...
8
votes
5answers
611 views

Does the responsibility of logging method/function calls fall to the caller or the callee?

What are the pros and cons to each of the following ways of logging a function call? This code is written in Ruby but I feel the question applies to programming in general. Responsibility belongs to ...
1
vote
1answer
236 views

logger initialization in JEE based web application

While working on a web (JEE based) application I saw some different ways people have instantiated loggers in different classes. First way is classic way like, private static final Logger logger = ...
5
votes
1answer
579 views

Interview question: “How do you make sure your logs are sufficient?” [closed]

I was in a job interview with a vp r&d today. I would like to ask it here, even though it is, in my opinion, too broad as a question. One of his questions went something like: "How do you make ...
2
votes
1answer
63 views

Capturing warnings when batch processing is ignored

My client has a process which iterates over a number of actions that may or may not apply to a users portfolio. Quite frequently, processing of an action may give up and jump to the next action or ...
53
votes
3answers
35k views

Best practices for logging and tracing in .NET

I've been reading a lot about tracing and logging, trying to find some golden rule for best practices in the matter, but there isn't any. People say that good programmers produce good tracing, but put ...
8
votes
4answers
2k views

How to add logging to a library so it can integrate easily with the logging system of the program using the library?

I'm writing a library that has a lot of information that may be of use in a log in the program which uses it, but I don't know the best way to expose it in such a way that the program using my library ...
0
votes
0answers
42 views

Do logs enhance availability of service for a well monitored application?

I used to work for teams that built software as a service applications. Our requirements, regarding production, were often the same : A complex service (web application, database, daemons, typically) ...
2
votes
2answers
101 views

How to implement change log of a ticket in complaint management system [closed]

One of the requirement, in the complaint management system were are designing, is to implement complete history of the ticket. For example Status was changed (new to pending to work in progres to ...
1
vote
2answers
221 views

Can there be too much logging? (Front End & Back End)

In a bit of a dilemma. At work we are having issues with an API service that communicates with the client side through a WebSocket. The problem so far is that the WebSocket seems to be unreliable. We ...
0
votes
1answer
123 views

When to use logger.info in sl4j

For my application logs for a REST server, I'd like to log some details about each http request. I'm using sl4j. Should I use logger.debug or logger.info More generally what sort of things should be ...
1
vote
5answers
444 views

Making logging more efficient and useful by categorizing data (and virtually not writining messages anymore)

I'd like to make my logs more useful. Currently they mostly contain such common columns as: timestamp, logger-name, log-level, message, exception. They are unsearchable and unparsable and writing ...
1
vote
0answers
107 views

Solution architecture for storing machine learning data

I'm building a mobile application using Expo & React Native. As the user interacts with the mobile app I need to store their interactions in Google BigQuery, so they can later be used to train ...
3
votes
2answers
344 views

Is there a specific name for this kind of debugging?

Imagine you have a system where a program is running and somehow an abnormality occurs. (it can be a crash, or an abnormal screen or any other thing) Imagine reproducing the problem is next to ...
-1
votes
1answer
217 views

What is the C++ equivalent of a logging facade in Java?

I'm currently writing a library in C++ and was wondering if I should log from within it. Googling the issue I came across this question but it makes reference to a logging facade. Is there anything ...
0
votes
1answer
48 views

How to ensure that every log event will be delivered to the GrayLog

In our applications we traditionally log events locally into the logging files. As our applications are distributed on multiple server instances, searching for particular events are complicated and ...
0
votes
1answer
49 views

Custom remote logging strategies

I am implementing an asynchronous remote (to aws S3) logging handler (in python, but it doesn't matter) supporting 4 modes: Immediate: the messages get written immediately to S3 - I am trying to ...
3
votes
1answer
345 views

Why would CPython logging use a Lock for each handler rather than one Lock per Logger?

While developing my own logging library, I studied the source code of the standard logging module of CPython. One of its features is that handlers are thread-safe. One can write logs to a file from ...
8
votes
4answers
1k views

Should log statements be tested?

When writing tests I usually ignored logging statements, but now I wonder if it was right. The logs are often important tools when diagnosing production issues, moreover there can even be ...
1
vote
0answers
45 views

Logfile correlation finder (for j4Log)

I'm currently analyzing a problem in a old "distributed" system, that only occurs sporadically - as the system does not support other means of debugging help I have to rely on the logs (I did not ...
3
votes
3answers
165 views

Drawing lines with dashes in logs

It can sometimes ease readability to "draw" lines in a logfile. For example: noise noise ----------------------------- Starting Operation ABC blabla blabla ----------------------------- End of ...
1
vote
1answer
183 views

Logging patterns from within library code

I am looking for a design pattern for logging from within library code. Suppose I have a function in a library file that i expect will be used by multiple front-ends (lets assume a CLI and a web): ...
25
votes
4answers
28k views

Logging into text file or database?

When should I use database for logging and when text files? I see that web servers and web frameworks (that your app uses internally) usually (always?) log requests and errors into text files by ...
1
vote
1answer
706 views

Logging architecture in microservices

We are going to develop an enterprise level application which will be run by a dozen microservices. Every microservice will be inside docker and all this will be orchestrated by Kubernetes. Obviously, ...
15
votes
8answers
5k views

Should I log errors on exception throwing constructors?

I was building an application for a few months and I come to realize a pattern that emerged: logger.error(ERROR_MSG); throw new Exception(ERROR_MSG); Or, when catching: try { // ...block that ...
5
votes
6answers
790 views

Where to position logging statements

I have the following classes : class Task { public void DoSomething() { var s = new Service(); s.First(); s.Second(); s.Third(); } } class Service { ...
0
votes
2answers
139 views

Handling logging when there is no internet access

I'm developing an application that handles sales for multiple clients, when the client sells a particular item, that information should be send to the admin. The count of each item sold and the item ...
3
votes
2answers
138 views

How would you go about designing a structured log pattern for systems?

My web app generate log entries on hooks such as model.save. Right now, I have a class Entry (representing a log entry) with a string field content to contain the text of the log entry. Examples of ...
1
vote
2answers
234 views

Rotated log file - what is it?

What does rotated log file means? There is any example? I used to see this term in logging libraries documentation but couldn't understand the meaning. Update: there is any different from a rolling ...
1
vote
1answer
240 views

Logging Architecture Solution

Let me start by setting up the context briefly. In our organization (a Big Data company), there are many different systems, including Web sites, workers (system listening to queues and/or topics), ...
1
vote
1answer
959 views

Fastest way to persist an append-only ordered event stream

I'm looking to persist a stream of events and I want it to be: fast in both latency and throughput, looking at at least 100k events per second ordered (not by timestamp, as multiple events within the ...
0
votes
1answer
343 views

When doing oop in python where should I add the logger

When doing oop in python where should I add the logger. Should I add it: before the class Rocket(): and give it a file global scope or after the class Rocket():  and give it a class scope. Syntax ...
14
votes
3answers
3k views

Why create a Logger object instead of using static logging methods across an application?

Taking an example of a simple Ruby on Rails application. It creates a Logger object during application load process: # in environment.rb config.logger = Logger.new(<STDOUT | file | whatever>) #...
0
votes
1answer
283 views

Application analytics - Logging with NoSQL/RDBMS, BigData [closed]

I need to architect a system for my company. My question is specific to logging. Part of the requirement is to log 2 kinds of data. A1. User events (Ex: UserA clicked on Button1, performed Action#21. ...
4
votes
3answers
2k views

Is it still a good practice to log parameters and returns?

Just a context, I am currently making a base code for a Java Spring Boot Application. I am currently setting up the logging of the application and I stumbled upong this url and found it helpful. ...
0
votes
2answers
680 views

what is the impact of logging (or excessive logging) of messages to log file on application performance?

Do logging impact application performance? First thing to know is , whether logs are written serially as processing takes place or are logged into file i a separate process? In java world how should ...
6
votes
3answers
1k views

Better conditional debugging pattern?

Given the need to log only in debug mode the easiest way would be to use if conditions: def test(x, debug=False): if debug: print(x) # ...Some more code if debug: print("...