What are you trying to do with the locationInfo? Appenders are not directly attached to Loggers. Every logger will be associated with a LoggerConfig. The LoggerConfig may be associated with one or more Appenders.
It would be helpful to know a little more about what you are trying to do. Log4j 2 is very different than Log4j 1 and it may be that Log4j 2 already provides the means to achieve what you are trying to do. Ralph > On Jan 23, 2015, at 12:17 PM, Onion Crucian <[email protected]> wrote: > > Hi, > > I am doing POC to migrate current project from using log4j1 to log4j2. > There are custom appenders in our projects and we are using a lot of log4j > internal APIs. There are a few things I couldn't find the new way to > achieve. I appreciate if anyone can help. > > 1 LocationInfomation. > > we used to get locationinformation like this in case of no exception thrown > from caller: > > locationInfo = new LocationInfo(new Throwable(), > logEvent.getFQNOfLoggerClass()); > > I couldn't find the log4j2 implenentation to do the similar thing. > 2 how to getAppender from logger? we have a lot of code to get the appender > in the project: logger.getAppender(appenderName). I read the api for the > log4j2, I couldn't find any. > > Thank you all for your time. > > Wei --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
