IncludeLocation is false by default: * For synchronous logging, the expensive operation (taking a stack trace snapshot) is only performed if the pattern configuration needs it (has some location parameters as you indicated). If the pattern configuration does not have location parameters then location information is not obtained.
* For asynchronous logging, this works differently. Still, by default location information is not obtained. The difference with synchronous logging is that just specifying a pattern with location parameters is not enough. If you want to log location info, you also need to specify a value of "includeLocation=true" in the configuration of your async logger or async appender. See also: http://logging.apache.org/log4j/2.x/manual/async.html#Location Best regards, Remko On Sun, Nov 30, 2014 at 5:29 PM, Yair Ogen (yaogen) <[email protected]> wrote: > I am using log4j2.1. any reason this flag is set to true by default? It is > very expensive (cpu wise) and AFAIK is something usually set by the pattern > (i.e. display source file and source line). > >
