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.
71
votes
14answers
13k views
Why do most log files use plain text rather than a binary format?
Logging is something that is necessary but is (relatively) rarely used. As such it can be made much more compact in terms of storage.
For example the data most commonly logged like ip, date, time and ...
0
votes
0answers
46 views
Web application logging strategy
Basically:
I am creating an enterprise web application. I would like to do extensive logging of both client and server activity, with all logs ultimately stored on the server. I have found many ...
4
votes
3answers
254 views
Logging paradigms, DI/IoC, object hierarchies
I'm trying to figure out how to support the following example scenario
ill be using C# as the example language.
Scenario
NASA is sending Rovers and Satellites to different Planets
these vehicles ...
1
vote
2answers
116 views
How do you log potentially sensitive data?
I'm working on a web application where the server side makes calls to a foreign server's web service API. The data passed to this API could contain sensitive data (like a user's password) as part of ...
1
vote
0answers
48 views
How should I store user activities in ElasticSearch and figure out popular searches?
I've got java logging user activities to Fluentd, Fluentd is then writing these activities into an elasticsearch index.
Every user activity is recorded, some include:
User1 follows user2
User1 ...
0
votes
1answer
102 views
Common helper class for logging
I have few classes which used System.out.println (which should be avoided) and now I am trying to move those into a logger.
We already have been using logger in some other modules. But the module I'm ...
1
vote
0answers
85 views
Good practices for logging incoming web requests?
I am develloping a web app which will receive a lot of requests. Those requests involve multiple functions in the code, and I'd like to have logs about thoses functions results depending of the ...
1
vote
1answer
41 views
Adding custom object-string transformers to a global static list field in my logging library. Is there a better way?
I'm writing a central logging library. In it is an AutoLogAttribute method attribute that automatically logs entry/exit of methods and their parameters (automatically serialized) like this:
[AutoLog]
...
0
votes
1answer
82 views
User-related logging in the microservices architecture
What is the best practice for logging user-related data in microservices architecture?
In example: I would like to audit/persist to database information on who deleted a resource.
I have user info on ...
0
votes
0answers
28 views
In an ESB type system, what field name should be used as a “correlation ID”?
We're using ASP.NET Web API and Azure Service Bus and adding logging to our disparate services and systems. We need to track a correlation ID to the headers of each set of bus messages as well as logs ...
1
vote
1answer
127 views
Standalone library for error logging?
Background
Here is how I currently log any exceptions that occur in my code:
Pass each object instance the path to a file where I want all of the logging to happen.
Each of the objects have their ...
2
votes
3answers
444 views
Logging an audit trail (Java application)
I'm creating a Java (Spring Boot) application for creating Entities. I've got my @Controller for getting the data from a web front end, I've got my @Service for processing the data, and I've got my @...
1
vote
2answers
123 views
Does it make sense to internationalize logs?
I'm working on converting the logging API used by a web application from log4j to slf4j, and noticed that the interface used to abstract over the log4j implementation supports internationalization; I ...
2
votes
1answer
30 views
Handling and reporting errors consistently
Errors can come from many different sources - third-party services, libraries, environment, etc. When an error prevents a user from performing their desired action, these diverse errors should be ...
2
votes
1answer
935 views
Logging RestTemplate's responses
I want to log responses using Spring's RestTemplate.
At first I thought I should do it using a ClientHttpRequestInterceptor, but since every set of requests should be logged to a different file, I ...
3
votes
4answers
408 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 ...
2
votes
2answers
202 views
Can I alter the code while adding logging?
When I add logging (e.g. log4j2 in Java) to existing code, is it ok (good practice), to alter the code?
Consider the following example:
//if process returned 0 return true
return (returnCode == ...
14
votes
2answers
1k 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 ...
1
vote
1answer
436 views
Log4j logger per class vs logger per application
I am stuck at understanding a concept related to Logger creation, especially in the context of Java EE.
In my experience, I nearly always used one logger per application, with few cases when I needed ...
0
votes
1answer
70 views
Integrating Logging Library into multilayer Object: What is a good structure?
I am integrating Serilog into and existing multilayer library that I've create. The previous logging technique I used was simply passing a string up the layers with events. I'd like to get away from ...
0
votes
0answers
42 views
Logging strategy for login transactions
We have a login process which is facilitated by a product default logging mode of which is text file based. Now because that is log4j based logging, one can use the custom appended to call our ...
3
votes
3answers
123 views
Should we reuse web app logs for user behaviour analytics?
Our web app generates a large amount of logs. These logs include both events regarding background operations in the app (data arrives from the server, ajax failures, inter-component communication, etc....
0
votes
2answers
113 views
Should I log errors in the function they occur? or pass them back and log them when control returns?
One of the things I love about Go is how they encourage passing errors as return values, but when it comes to logging what is the most maintainable solution: passing the error as far back down the ...
4
votes
0answers
278 views
Log with Application Insights only (NLog vs AI) in Asp MVC
I was going through several blog posts and stackoverflow and programmers and I am still a bit confused. You can install NLog (or some other logging lib) and start logging quite fast and then you can ...
12
votes
6answers
666 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 ...
0
votes
0answers
30 views
Logging of sent/received emails within a web application
We're finally migrating our client/server system to the cloud and would appreciate help on the handling of email within the webapp. Currently we monitor the inbox/sent items of Outlook.
It seems that ...
1
vote
1answer
113 views
Are there any arguments for using a local logger variable
PMD Rule LoggerIsNotStaticFinal:
In most cases, the Logger reference can be declared as static and final.
I seem to remember some arguments for using local variables for logging, but cannot ...
1
vote
0answers
40 views
Most suitable solution for logging traffic to external services - ASP.NET
My application relies on several external services - labelled Service A, Service B and Service C in the diagram. I am looking at ways of logging the number of requests made to these services, and the ...
5
votes
4answers
859 views
Design pattern for wrapping logging around execution
Introduction
I am implementing a abstract Java class of a processing framework*. By implementing the function execute, I am able to add business logical functionality. I would like to add logging at ...
2
votes
2answers
274 views
Adding centralized logging mechanism to Project (Best Practice)
I want to add a logging mechanism to my project but I am afraid to have logging code spread all over the place.
I thus had the idea of having only one class Logger responsible for writing relevant ...
1
vote
4answers
164 views
Better way of handling pre conditions and logging
1. Imagine you have the following:
void Foo::doFoo()
{
if (!isConditionValid())
{
log("doFoo not possible because condition is not valid");
return;
}
if (!...
0
votes
1answer
49 views
Should I try to read user input for logger data?
Our logger data has gotten a bit out of hand, so I am trying to find ways to trim out unnecessary log information.
What I've found is that the programmer who implemented the logs (no longer working ...
1
vote
0answers
740 views
A way to trace each sqlite query
I've got big and hairy app with sqlite via dbi (from .c) as a backend - plenty of select/insert/update/delete queries.
From looking through documentation I did not found a way to log all the queries ...
1
vote
0answers
130 views
Approach for polyglot logging
I'm building a desktop app with a Java front-end and very performance critical Fortran libraries. We've recently started pushing more of our code out of Java and into Fortran (see below)
Soon we will ...
-1
votes
2answers
120 views
Should client side have a log? [closed]
The client side of my application is written in VB.Net, it accesses a java server.
Server logs every request that was made by client, client shows every exception to the user (with an option to send ...
2
votes
1answer
199 views
Module level logger function
I've recently been assigned to a new project because I'm one of the only developers at my company who has used Python extensively in the past. My first task was to clean up the code base and make it ...
1
vote
3answers
104 views
Event logging: record a whole message, or a list of properties and generate?
I've written a simple event logging system, which I write to with a function similar to:
void IIncidentLogic.ReportIncident(
string code,
string noun,
string hostname,
DateTimeOffset ...
11
votes
3answers
977 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
60 views
Logging private data
In general, I write a debug log whenever one of my functions is entered, including the parameters.
For instance:
function execute_query($query, $conn_string)
{
$this->log->...
2
votes
1answer
3k 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);
// ...
2
votes
1answer
73 views
log method calls per object
How to log method calls on a per object basis for a particular class?
I.e. after instanciating a = myClass() I somehow want to keep a log for what methods have been called on a like
a.reverse()
a....
4
votes
2answers
251 views
Strategies to analyze collected exceptions
We want to add error feedback to our application. I had a look at existing solutions (e.g. raygun.io), but these work "in the cloud", which is a no-go for us:
most installations of our application ...
3
votes
2answers
470 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. ...
29
votes
6answers
13k 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 ...
1
vote
0answers
123 views
How to to log clicks for a Pay-Per-Click software?
Let say you have a Website with advertising, and each time a user clicks on it, you want to charge an advertiser the amount he bids (basically, a pay-per-click system, like Adswords, with a different ...
4
votes
3answers
858 views
Write progress from a long running process
We have some long running processes which could run for as long as an hour up to 6 hours.
Some of the processes are started by hand and the user wants to see what the progress of the process is.
...
15
votes
6answers
3k views
Is logging next to an implementation a SRP violation?
When thinking of agile software development and all the principles (SRP, OCP, ...) I ask myself how to treat logging.
Is logging next to an implementation a SRP violation?
I would say yes because ...
1
vote
1answer
53 views
Loggers - Functional, non-functional or layered?
We use different loggers to break up and apply specific rules to different kinds of log data. We typically specify which logger to be used with something like this:
var logger = Logger.GetLogger("...
1
vote
2answers
697 views
Adding Logging to a pre-existing Program
I have a game that I have been writing in java as a hobby for a number of years. I have very sparse logging, just some simple output when something goes really wrong. It's about 25,000 lines of code.
...
1
vote
2answers
174 views
Logging function names on systems with few (memory and space) resources
Our logging module has a buffer that often gets full and we are searching for a solution to shorten our logs, without making any compormise in performance.
The code is written in C++ and currently we ...