logging

Good way to time SQL queries when using Linq to SQL

Is there a good way to time SQL queries when using Linq to SQL? I really like logging feature, but it would be great if you could somehow also time that query. Any ideas? ...

Java logger that automatically determines caller's class name

public static Logger getLogger() { final Throwable t = new Throwable(); final StackTraceElement methodCaller = t.getStackTrace()[1]; final Logger logger = Logger.getLogger(methodCaller.getClassName()); logger.setLevel(ResourceManager.LOGLEVEL); return logger; } This method would return a logger that knows the class it's logging fo...

Should a Log4J logger be declared as transient?

I am using Java 1.4 with Log4J. Some of my code involves serializing and deserializing value objects (POJOs). Each of my POJOs declares a logger with private final Logger log = Logger.getLogger(getClass()); The serializer complains of org.apache.log4j.Logger not being Serializable. Should I use private final transient Logger log...

Logging activities in multithreaded applications

I have a layered application in Java which has a multi thread data access layer which is invoked from different points. A single call to this layer is likely to spawn several threads to parallelize requests to the DB. What I'm looking for is a logging tool that would allow me to define "activities" that are composed by various threads....

Best way to aggregate multiple log files from several servers

I need a simple way to monitor multiple text log files distributed over a number of HP-UX servers. They are a mix of text and XML log files from several distributed legacy systems. Currently we just ssh to the servers and use tail -f and grep, but that doesn't scale when you have many logs to keep track of. Since the logs are in differe...

log4j log file names?

We have several jobs that run concurrently that have to use the same config info for log4j. They are all dumping the logs into one file using the same appender. Is there a way to have each job dynamically name its log file so they stay seperate? Thanks Tom ...

Preferred logging infrastructure for .Net

What is your preferred logging infrastructure for .Net - NLog, log4net, other? Please, specify why you would use one vs. another (pros and cons). Edit: I find it really difficult to "accept" an answer, as there is no enough data to compare. I.e. favoring one of the possibilities, w/o specifying features, that others lack, or are better ...

What's the Best Logging Package for Delphi?

Choosing the "best" logging package for Delphi will naturally be rather subjective, but it would be good to know what the main options are, and the popular opinion on them. I'm basically looking for a robust logging package that will: Log to a file that I specify. Record a stack trace if I pass it an Exception. Ideally be popular, and...

Can anyone recommend a simple Java logging framework?

I've evaluated Log4j and Commons Logging, along with Java's built-in logging, however frankly all of these frameworks seem over-engineered, and over-complicated, requiring excessive configuration just to achieve basic functionality. Is anyone aware of a simple, yet flexible open source Java logging framework? Update: In response to a q...

Proper Logging in OOP context

Here is a problem I've struggled with ever since I first started learning object-oriented programming: how should one implement a logger in "proper" OOP code? By this, I mean an object that has a method that we want every other object in the code to be able to access; this method would output to console/file/whatever, which we would use...

Log4j: Why is the root logger collecting all log types regardless the configuration?

I am having problem that even though I specify the level to ERROR in the root tag, the specified appender logs all levels (debug, info, warn) to the file regardless the settings. I am not a log4j expert so any help is appreciated. Here is a bit more info on the subject: I have checked the classpath for log4j.properties (there is none)...

PostSharp - il weaving - thoughts

I am considering using Postsharp framework to ease the burden of application method logging. It basically allows me to adorn methods with logging attribute and at compile time injects the logging code needed into the il. I like this solution as it keeps the noise out of the deign time code environment. Any thoughts, experiences or better...

What debug logging tools are available from Javascript?

I'd like to create a "universal" debug logging function that inspects the JS namespace for well-known logging libraries. For example, currently it supports Firebug's console.log: var console = window['console']; if (console && console.log) { console.log(message); } Obviously, this only works in Firefox if Firebug is installed/enabl...

Should I catch exceptions only to log them?

Should I catch exceptions for logging purposes? public foo(..) { try { ... } catch (Exception ex) { Logger.Error(ex); throw; } } If I have this in place in each of my layers (DataAccess, Business and WebService) it means the exception is logged several times. Does it make sense to do so if my layers are in...

What is the best logging solution for a C# .NET 3.5 project

Hi, My team is about to start a new enterprise wide ASP.NET development project, quite possibly the largest undertaken by my department so far and the largest project that I've ever worked on. I'm looking for a good logging solution for the system. There are two questions I have if anyone knows the answer. Firstly what logging tool...

Logging Application Block - Logging the caller

When logging with Log4Net it's very easy to put class that called the log into the log file. I've found in the past that this makes it very easy to trace through the code and see the flow through the classes. In Log4Net I use the %logger property in the conversion pattern like so: <conversionPattern value="%date [%thread] %-5level %l...

Asp.net c# and logging ip access on every page and frequency

Are there any prebuilt modules for this? Is there an event thats called everytime a page is loaded? I'm just trying to secure one of my more important admin sections. ...

How do I remove loadbalancer pollution from my access logs

I have a pair of Sun web servers (iws6) sitting behind a load balancer. It likes to know if the web servers are up and continually asks for /alive.html. That is fine but how do I not log that in my access log? Failing that, how could I have the archiver strip out that accesses when it roles the file over? I would prefer something more ...

Production Logging in Flex

Is there any way to capture the trace statements of your Flex app while not running in debug mode? Or is there any other way to output logging information when not running a debugger? Currently I'm trying to fix a bug that only presents itself in very specific deployment scenario, but I could see this being useful in some instances for...

Conditional logging with minimal cyclomatic complexity

After reading "What’s your/a good limit for cyclomatic complexity?", I realize many of my colleagues were quite annoyed with this new QA policy on our project: no more 10 cyclomatic complexity per function. Meaning: no more than 10 'if', 'else', 'try', 'catch' and other code workflow branching statement. Right. As I explained in 'Do you...