Hello, Donpwinston. In the link you shared, I see that the correct dependency version should be 2.11.0; please try to change it in your pom.xml.

0

Ok. I figured out I have to reload Maven periodically and these flagged dependency “not found”   errors clear up. I do not think it should be necessary to do that.

But another problem I have is that IntelliJ is validating my logback.xml and telling me the level attribute of the root element is not allowed and wants me to use a level element instead. This has been deprecated in the most recent versions of logback for a while now. The <root level="debug"> is indeed the proper way to specify a level in the logback.xml file. How do I get IntelliJ to use the proper xml schema? I do not see a schema for logback anywhere. Logback's documentation doesn't mention a schema or DTD. I don't see how to turn it off in IntelliJ via the inspection settings.

0

Satch Are you referring to

<configuration>
	<...>
    <root level="debug">
        <appender-ref ref="STDOUT" />
        <appender-ref ref="FILE" />
    </root>
	<...>
</configuration>

section of the logback.xml?

I've tested this in my environment and IDEA does not seem to report any issues with this configuration.

Could you please let me know which version of logback and IDEA you're using and share your logback.xml file along with a screenshot showing the error message?

0

IDEA: IntelliJ IDEA 2024.3 EAP (Ultimate Edition)

logback: 1.5.10

 

 

 

 

0

Satch Thank you for sharing the details!

I've replicated your setup as shown on the screenshot with the same versions of logback and IDEA, but the error message does not come up in my environment.

Would you be able to share the affected Project or the logback-test.xml file from it for further investigation?

Which options does it give you under “More actions…” link?

0

More actions… shows “Convert attribute to child tag” and “remove attribute”, and use AI.

The child tag <level> is deprecated.

Here's my logback.xml: 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration>
<configuration>

  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%date %5level [%file:%line] - %msg%n</pattern>
    </encoder>
  </appender>

  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <file>mail.log</file> <!-- Specify the file name here -->
    <encoder>
      <pattern>%date %5level [%file:%line] - %msg%n</pattern>
    </encoder>
    <append>true</append>
  </appender>

  <root level="info">
    <appender-ref ref="FILE"/>
  </root>

</configuration>

 

0

I'm using a Mac if that matters. Maybe it is picking up and old version of logback in my .m2 directory? I'll try deleting them.

0

I can do this to avoid the issue:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration>
<configuration>

  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%date %5level [%file:%line] - %msg%n</pattern>
    </encoder>
  </appender>

  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <file>mail.log</file> <!-- Specify the file name here -->
    <encoder>
      <pattern>%date %5level [%file:%line] - %msg%n</pattern>
    </encoder>
    <append>true</append>
  </appender>

  <logger name="gov.uscourts.bnc.console" level="debug">
    <appender-ref ref="CONSOLE"/>
  </logger>

  <logger name="gov.uscourts.bnc.file" level="info">
    <appender-ref ref="FILE"/>
  </logger>

  <root>
    <appender-ref ref="CONSOLE"/>
    <appender-ref ref="FILE"/>
  </root>

</configuration>
0

Hi Satch , I've created an issue for this: https://youtrack.jetbrains.com/issue/IJPL-164814/False-positive-on-log4j.xml-with-DOCTYPE-configuration

Please check if it covers all the points here. Feel free to vote and watch the YouTrack item to be notified when it has updates. If you need to become more familiar with YouTrack, see [this article](https://intellij-support.jetbrains.com/hc/articles/207241135).

0

请先登录再写评论。