You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Matt Brown <ma...@mattnworb.com> on 2014/11/26 19:39:14 UTC

Use of line number and file name in default cassandra logging configuration

In the logging configuration that ships with the cassandra distribution (log4j-server.properties in 2.0, and logback.xml in 2.1), the rolling file appender is configured to print the file name and the line number of each logging event:

    log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n

Both the log4j <http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html> and logback documentation <http://logback.qos.ch/manual/layouts.html> warn that generating the filename/line information is not a cheap operation:

> Generating the file information is not particularly fast. Thus, its use should be avoided unless execution speed is not an issue.

The implementation for both involves creating a new Throwable and then printing the stack trace for the throwable to find the file name or line number.

Is there a particular reason why the official distribution configures the logging like this, instead of using the logger name (%c)? 

Cassandra would seem like the perfect description of a place where execution speed is an issue.



Re: Use of line number and file name in default cassandra logging configuration

Posted by Robert Coli <rc...@eventbrite.com>.
On Wed, Nov 26, 2014 at 11:57 AM, Matt Brown <ma...@mattnworb.com> wrote:

> I created https://issues.apache.org/jira/browse/CASSANDRA-8379 and
> attached patches against trunk and the cassandra-2.0 branch.
>

Sweet. Thanks for closing the loop and letting the list know the JIRA info.

=Rob

Re: Use of line number and file name in default cassandra logging configuration

Posted by Matt Brown <ma...@mattnworb.com>.
I created https://issues.apache.org/jira/browse/CASSANDRA-8379 <https://issues.apache.org/jira/browse/CASSANDRA-8379> and attached patches against trunk and the cassandra-2.0 branch.


> On Nov 26, 2014, at 2:05 PM, Robert Coli <rc...@eventbrite.com> wrote:
> 
> On Wed, Nov 26, 2014 at 10:39 AM, Matt Brown <matt@mattnworb.com <ma...@mattnworb.com>> wrote:
> Both the log4j <http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html> and logback documentation <http://logback.qos.ch/manual/layouts.html> warn that generating the filename/line information is not a cheap operation:
> 
> > Generating the file information is not particularly fast. Thus, its use should be avoided unless execution speed is not an issue.
> 
> Your observation seems reasonable on its face. I suggest filing it as a JIRA at http://issues.apache.org <http://issues.apache.org/>
> 
> =Rob
>  


Re: Use of line number and file name in default cassandra logging configuration

Posted by Robert Coli <rc...@eventbrite.com>.
On Wed, Nov 26, 2014 at 10:39 AM, Matt Brown <ma...@mattnworb.com> wrote:

> Both the log4j
> <http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html>
>  and logback documentation <http://logback.qos.ch/manual/layouts.html> warn
> that generating the filename/line information is not a cheap operation:
>
> > Generating the file information is not particularly fast. Thus, its use
> should be avoided unless execution speed is not an issue.
>

Your observation seems reasonable on its face. I suggest filing it as a
JIRA at http://issues.apache.org

=Rob