Doesn't work also with LoggerLog4jDebugAppender.
Could it depends of the fact is the package is default?
I mean:
MainLog4j2
src
default package
file.java
file.xml
On 2020/03/19 15:25:20, Doug Wegscheid <[email protected]> wrote:
> There is no appender named "LoggerLog4jDebug". The appender is probably
> "LoggerLog4jDebugAppender"?
>
> On Thursday, March 19, 2020, 11:19:35 AM EDT, EDMONDO SENA
> <[email protected]> wrote:
>
> The code is:
> try {
> ConfigurationSource source = new ConfigurationSource(new
> FileInputStream("Log4jApache.xml"));
> Configurator.initialize(null, source);
> } catch (IOException e) {
> System.err.println("Error while initializing log4j from file:
> log4j.xml");
> e.printStackTrace();
> }
>
> LoggerContext context = (LoggerContext) LogManager.getContext(false);
> Appender appender =
> context.getConfiguration().getAppender("LoggerLog4jDebug");
> System.out.println("appender = " + appender);
>
> File xml is:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="ERROR">
> <Appenders>
> <Console name="LoggerLog4jDebugAppender" target="SYSTEM_OUT">
> <PatternLayout pattern="log4j: %msg%n"/>
> </Console>
> <Console name="LoggerLog4jErrorAppender" target="SYSTEM_ERR">
> <PatternLayout pattern="log4j: %msg%n"/>
> </Console>
> </Appenders>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]