Tag Info

New answers tagged

1

This screams out for a Log4Net custom appender. You could write your own, have it check the active item to determine whether to log or not, and log to a per-item memory buffer.


11

Since you are using this information for billing purposes, I do not see why you would not want it in the database where it can be easily queried, aggregated, reported on, and joined to other data. I also think it's much easier to maintain a single database table containing the log information than a bunch of separate log files. Same with your concern ...


2

If coupling users to the logging framework is an issue, you may use: Either Dependency Injection to make the consumers of the shared library provide the library with the logging feature. Of course, this means that either there is a common logger interface which is standardized enough, such as PSR-3 for PHP, or you are able to provide an interface generic ...


7

If logging is critical to your application, then one should stop the application if logging fails. If not critical, then being somewhat defensive one could have a secondary component to handle logging failures that logs/alerts to a secondary source. But even that is not fool proof and you will have to consider what happens if the secondary logger fails ...


12

When you encounter exceptions within the logger itself, you shouldn't use the logger to log its own exceptions. The reason for that is that: You may be stuck in an infinite loop. Imagine that within your logger, you have a conditional branch which wasn't tested (and generates an exception). Imagine that once the condition is met, any further reported ...


1

I would use a simple sed substitute command with ANSI escape codes put before and after the matching RE. tail -f logfile.log | sed 's/\(error\)/^[[42m\1^[[0m/g' where ^[ is an ESC character that you can obtain by pressing ctrl-V ESC If you do need a highlight command, you can define it as a shell function: highlight() { sed 's/'"$1"'\)/^[[42m\1^[[0m/g' ...


5

I believe you misunderstood the recommendations for logging. The 12 Factor site states A twelve-factor app never concerns itself with routing or storage of its output stream. It should not attempt to write to or manage logfiles. Instead, each running process writes its event stream, unbuffered, to stdout. During local development, the developer will ...



Top 50 recent answers are included