P
P
P_Alexander2018-06-08 19:14:15
Java
P_Alexander, 2018-06-08 19:14:15

How to fix ERROR Loggers cannot be configured without a name: arg[2](String)?

Hello, I can't figure out how to solve this problem, please help. Tried to add a name but to no avail. (it seems to work, but errors also fly, I want to figure it out)
Do I still need to register the log settings file in the configuration spring, I heard something about it but didn’t find any examples !?
Logger settings file

<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Appenders>
        <!--Console Appender-->
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %msg%n"/>
        </Console>

        <!--File Appender-->
        <File name="File" filename="/home/alex/www/MakeYourDream/src/main/resources/log/app.log">
            <PatternLayout pattern="%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %msg%n"/>
        </File>
    </Appenders>
    <Loggers>

        <!--<Logger name="com" level="trace">-->
            <!--<AppenderRef ref="Console"/>-->
        <!--</Logger>-->
        <!--<Logger name="test/">-->
            <!--<AppenderRef ref="Console"/>-->
            <!--<AppenderRef ref="File"/>-->
        <!--</Logger>-->

        <Root level="error">
            <AppenderRef ref="Console"/>
            <AppenderRef ref="File"/>
        </Root>
    </Loggers>
</Configuration>

Stacktrace
2018-06-08 18:57:15,857 main ERROR Loggers cannot be configured without a name: arg[2](String)
2018-06-08 18:57:15,864 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.config.LoggerConfig for element Logger. org.apache.logging.log4j.core.config.ConfigurationException: Arguments given for element Logger are invalid
  at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:270)
  at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:131)
  at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
  at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892)
  at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884)
  at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
  at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
  at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
  at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
  at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617)
  at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634)
  at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229)
  at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
  at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
  at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
  at org.apache.commons.logging.LogFactory$Log4jLog.<clinit>(LogFactory.java:199)
  at org.apache.commons.logging.LogFactory$Log4jDelegate.createLog(LogFactory.java:166)
  at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:109)
  at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:99)
  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<clinit>(SpringJUnit4ClassRunner.java:99)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
  at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
  at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
  at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
  at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
  at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
  at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:36)
  at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)
  at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
  at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
  at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

2018-06-08 18:57:15,880 main ERROR Null object returned for Logger in Loggers.
2018-июн-08 18:57:20 PM [main] ERROR start.WriteStartTest - HELLO
Hibernate: select nextval ('pc_seq_role')
Hibernate: select nextval ('pc_seq_user')
2018-июн-08 18:57:20 PM [main] ERROR start.WriteStartTest - HELLO2

Process finished with exit code 0

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Eremin, 2018-06-08
@P_Alexander

The Internet says you need to put
logging.config={path to your log4j.xml} in the .properties file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question