Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Обновление логирования на курсе #1810

Open
yarmail opened this issue Jan 8, 2025 · 0 comments
Open

Обновление логирования на курсе #1810

yarmail opened this issue Jan 8, 2025 · 0 comments

Comments

@yarmail
Copy link

yarmail commented Jan 8, 2025

Предложил бы обновить систему логирования в курсе
(если вы сочтете это уместным)

Соображения

  • версии log4j наверное лет 10
  • Если я правильно понимаю - производитель logback нативно реализует slf4j, так что совместимость будет лучше, скорость выше, а также меньше зависимостей
  • также logback взяли в Spring, а там абы кого брать не будут
  • JDK 21 нормально работает с logback

Зависимости (на январь 2025)

    <!-- Log Jan 2025-->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>2.0.16</version>
    </dependency>

    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.5.16</version>
    </dependency>

пример настроек (с разноцветными строками) logback.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>
%d{yyyy-MM-dd HH:mm:ss} %highlight(%-5level) %logger{36} - %msg%n
            </pattern>
        </encoder>
    </appender>

    <root level="info">
        <appender-ref ref="STDOUT" />
    </root>
</configuration>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant