nputStream("Log4jApache.xml"));
>> Configurator.initialize(null, source);
>> } catch (IOException e) {
>> System.err.println("Error while initializing log4j from
>> file: log4j.xml");
>> e.p
ot;);
> e.printStackTrace();
> }
>
> LoggerContext context = (LoggerContext) LogManager.getContext(false);
> Appender appender =
> context.getConfigura
();
}
LoggerContext context = (LoggerContext) LogManager.getContext(false);
Appender appender = context.getConfiguration().getAppender("LoggerLog4jDebug");
System.out.println("appender = " + appender);
File xml is:
xception e) {
System.err.println("Error while initializing log4j from
file: log4j.xml");
e.printStackTrace();
}
LoggerContext context = (LoggerContext) LogManager.getContext(false);
Appender appender = context.getConfiguration().getAppend
ntext context = (LoggerContext) LogManager.getContext(false);
>>> FileAppender appender =
>>> context.getConfiguration().getAppender("LoggerLog4jDebug");
>>> System.out.println("appender = " + appender);
>>>
>>>
d I've got null.
> > Is right the casting to LoggerContext?
> >
> > LoggerContext context = (LoggerContext) LogManager.getContext(false);
> > FileAppender appender =
> > context.getConfiguration().getAppender("LoggerLog4jDebug");
>
) LogManager.getContext(false);
> FileAppender appender =
> context.getConfiguration().getAppender("LoggerLog4jDebug");
> System.out.println("appender = " + appender);
>
> Can you help me?
> //Edmondo.
>
>
>
> On 2020/02/19 15:31:53, Ralph Goers wro
Hi Ralph,
The example below that you mentioned I've got null.
Is right the casting to LoggerContext?
LoggerContext context = (LoggerContext) LogManager.getContext(false);
FileAppender appender =
context.getConfiguration().getAppender("LoggerLog4jDebug");
System.out.pr
LoggerContext context = LogManager.getContext(“false”);
FileAppender appender = context.getConfiguration().getAppender("info");
Ralph
> On Feb 19, 2020, at 7:47 AM, EDMONDO SENA wrote:
>
> Ok, but they are the API not examples
>
>
>
>
> On 2020/0
Ok, but they are the API not examples
On 2020/02/19 14:29:41, Gary Gregory wrote:
> Please see
> https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/config/Configuration.html#getAppender-java.lang.String-
>
> On Wed, Feb 19, 2020, 09:27
Please see
https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/config/Configuration.html#getAppender-java.lang.String-
On Wed, Feb 19, 2020, 09:27 EDMONDO SENA wrote:
>
> Can you tell me where can I find out these examples?
>
> Kind regards.
’s plenty of examples of how that is done in the tests.
>
> On Wed, Feb 19, 2020 at 04:23 EDMONDO SENA wrote:
>
> > 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
&
Appenders and such are part of the core library now. There are likely
features in log4j2 that could replace what you’re doing, though. In any
case, there’s plenty of examples of how that is done in the tests.
On Wed, Feb 19, 2020 at 04:23 EDMONDO SENA wrote:
> how to getAppender from logger?
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.
How can I fix it?
-
To unsubscribe, e-mail:
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
>
ed 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
16 matches
Mail list logo