You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geode.apache.org by Ashvin A <aa...@gmail.com> on 2015/06/18 01:23:22 UTC

LogMarker guidelines

Hi,

I can use log4j configuration to change log levels by specific packages and
classes. I noticed sizable usable of LogMarkers in the code for additional
filtering. I guess markers are used for cases beyond trace level logging
and across package boundaries. I was wondering if their are any guidelines
for marker usage. I am thinking of using marker for tracking inter-package
data/control flow? For e.g. To track a request specific to a background
task only. Does this sound reasonable?

Thanks,
Ashvin

Re: LogMarker guidelines

Posted by Kirk Lund <kl...@pivotal.io>.
Hi Ashvin,

The way we're using log markers is to provide an alternative way for
enabling verbose logging beyond just specifying log levels per class or per
package.

Some of our concepts (LRU, TOMBSTONE, DISTRIBUTION, etc) span code that
doesn't follow the same boundaries as classes or packages. If it's useful
to enable verbose logging for that concept without being limited to one
specific package or without being forced to enable verbose logging for the
entire class or package, then it seems to be a good candidate for the way
we're using log markers.

All of our current log markers were introduced to replace private static
DEBUG boolean flags that existed in various components -- before moving to
Log4J2, you would have to specify one or more system properties that would
change one or more DEBUG flags to enable additional verbose logging beyond
the control provided by log-level.

This sounds more or less in line with what you're stating though I'm not
sure it helps much with data or control flow. We use a
custom LogEventPatternConverter in our PatternLayout to add the native
thread id to each log statement. This helps a lot with following what one
thread is doing but it can be challenging to follow a request that hops
from one thread to another -- having a request id or reply processor id of
some sort that is part of each log message helps the most when it moves
among threads.

-Kirk

On Wed, Jun 17, 2015 at 4:23 PM, Ashvin A <aa...@gmail.com> wrote:

> Hi,
>
> I can use log4j configuration to change log levels by specific packages and
> classes. I noticed sizable usable of LogMarkers in the code for additional
> filtering. I guess markers are used for cases beyond trace level logging
> and across package boundaries. I was wondering if their are any guidelines
> for marker usage. I am thinking of using marker for tracking inter-package
> data/control flow? For e.g. To track a request specific to a background
> task only. Does this sound reasonable?
>
> Thanks,
> Ashvin
>