Re: Some question when migrating from log4j to log4j2

2017-11-27 Thread Ralph Goers
You can call the getSource() method of the LogEvent and it will return the StackTraceElement of the caller. Ralph > On Nov 27, 2017, at 7:22 PM, 代超 wrote: > > Hi all, > Nowadays I am upgrading the log component. I used to use the log4j and > customize our own appender by

Re: Fwd: Include location and performance

2017-11-27 Thread Mikael Ståldal
If you use Scala, you could use macros. On 2017-11-27 13:47, Martin Všetička wrote: Hi, I use Log4j2 with async logger and includeLocation=true. As the manual warns, it slows down my application 4 times. Are there any tips how to obtain location information without runtime performance hit? *

Re: How to build the Routing Appender with the ConfigurationBuilder

2017-11-27 Thread Ralph Goers
What you need to know is that with the ConfigurationBuilder everything is really a Component. Since Layouts, Appenders, Filters and Loggers are so common we have built specialized ComponentBuilders for them, but they could also be constructed with a generic ComponentBuilder.

How to build the Routing Appender with the ConfigurationBuilder

2017-11-27 Thread Jens Schmidt
Hello there, getting accustomed with log4j 2. It is awesome so far. However, i can't figure out how to create a routing logger with the ConfigurationBuilder API. I came this far: AppenderComponentBuilder routingAppender = builder.newAppender("Routing", "Routing"); And then what, how do you

Fwd: Include location and performance

2017-11-27 Thread Martin Všetička
Hi, I use Log4j2 with async logger and includeLocation=true. As the manual warns, it slows down my application 4 times. Are there any tips how to obtain location information without runtime performance hit? * I use Java 9 so that Log4j2 can use the stack walking API but it does not help too